摘要:
按题目的要求做记忆化递归View Code 1 #include <stdio.h> 2 #include <string.h> 3 int vis[21][21][21]; 4 5 int w(int a,int b,int c) 6 { 7 if(a <= 0 || b <= 0 || c <= 0) 8 return 1; 9 else if(a > 20 || b > 20 || c > 20)10 return w(20,20,20);11 else if(vis[a][b][c] > 0)12 return... 阅读全文
posted @ 2012-08-18 17:08
Wheat″
阅读(118)
评论(0)
推荐(0)
摘要:
DFS搜索由大的数往小的数View Code 1 #include <stdio.h> 2 #include <string.h> 3 int ans,n,a[1001]; 4 int b[1010]; 5 bool f; 6 void dfs(int v,int t,int g) 7 { 8 int i; 9 if(v==ans)10 {11 f = true;12 for(i=1;i<t-1;i++)13 printf("%d+",b[i]);14 printf("%d\n",b[t-1]);... 阅读全文
posted @ 2012-08-18 17:07
Wheat″
阅读(108)
评论(0)
推荐(0)
摘要:
一道几何题:设小圆半径为r,大圆为R,有图得 :R = r + r / sin(A);A = 2 * PI / (n * 2) = PI / n;联合得:r == R / ( 1 + ( 1 / sin( 2 * asin(1.0) /n)));PI = 2 * asin(1.0) 可以解决精度的问题View Code 1 #include <stdio.h> 2 #include <math.h> 3 int main(void) 4 { 5 int n,t; 6 double r1,r2; 7 scanf("%d",&n); 8 for( 阅读全文
posted @ 2012-08-18 16:07
Wheat″
阅读(85)
评论(0)
推荐(0)
摘要:
水题:求各个因子的和,再同n比较,小于输出DEFICIENT,等于输出PERFECT,大于输出ABUNDANT,附代码。#include <stdio.h>#include <string.h>int main(void){ int i,sum,n; puts("PERFECTION OUTPUT"); while(scanf("%d",&n)!=EOF && n) { printf("%5d ",n); sum = 0; for(i=1;i<n;i++) if(n%i==0) s 阅读全文
posted @ 2012-08-18 15:19
Wheat″
阅读(110)
评论(0)
推荐(0)

浙公网安备 33010602011771号