摘要: 题目链接难得的1A。想的时间有点长啊,精力集中不起来。思路:本来是开始把 a1 a2 a3... an 全部用题目中的表达式给表示出来,想着肯定会全部消去吧,结果。。。还剩下个an,然后,没啥想法了。。想想,试试规律吧。把n = 2 3 4 时候全部写出来了发现有规律啊。an 可以用a1和a0表示出来。。把an套到前一个推出来的公式去,然后,实现这个规律,又浪费一些时间。。。还好1A。 1 #include <stdio.h> 2 double c[5000]; 3 int main() 4 { 5 int i,j,t,m; 6 double a0,an,sum1,sum2,a.. 阅读全文
posted @ 2012-05-29 20:15 Naix_x 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2107裸DFS。 1 #include <stdio.h> 2 #include <string.h> 3 int p[101][101],o[101],num[101],z; 4 void dfs(int k,int v) 5 { 6 int i; 7 o[v] = 1; 8 num[z] = v; 9 z ++;10 for(i = 0;i <= k-1;i ++)11 {12 ... 阅读全文
posted @ 2012-05-29 15:51 Naix_x 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2139 裸BFS。 1 #include <stdio.h> 2 #include <string.h> 3 int p[1001][1001],o[1001],k[1001]; 4 int bfs(int n) 5 { 6 int i,j,start,end,a,num = 1; 7 start = end = 0; 8 while(start <= end) 9 {10 a = 1;11 ... 阅读全文
posted @ 2012-05-29 15:18 Naix_x 阅读(213) 评论(0) 推荐(0) 编辑