摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2186 1 #include <stdio.h> 2 int calc(int n) 3 { 4 return n/10+(n%10==0?0:1); 5 } 6 int main() 7 { 8 int C; 9 scanf("%d",&C);10 {11 while(C--){12 int num1,num2,num3,n;13 scanf("%d",&n);14 num1=n/2;15... 阅读全文
posted @ 2011-12-09 23:12 linyvxiang 阅读(180) 评论(0) 推荐(0)
摘要: http://ac.jobdu.com/problem.php?id=1342开始时没太读懂题, “去掉一些括号" 其实换句话说,就是看看有多少括号匹配过。。。 比上一个容易些,不用管连续不连续,用上一题的代码就可以 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <stack> 5 using namespace std; 6 int N; 7 char str[1000002]; 8 bool flags[1000002] = { 阅读全文
posted @ 2011-12-09 11:11 linyvxiang 阅读(368) 评论(0) 推荐(0)
摘要: http://ac.jobdu.com/problem.php?id=1337在混乱中写完了最后一个循环,要时刻警惕越界。。 还有就是indent还是不会用,直接把代码缩进搞乱了 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <stack> 5 using namespace std; 6 int N; 7 char str[1000002]; 8 bool flags[1000002] = { false }; 9 10 stack < 阅读全文
posted @ 2011-12-09 10:58 linyvxiang 阅读(323) 评论(0) 推荐(0)
摘要: http://ac.jobdu.com/problemset.php?page=4floyd算法,只要看新修建的路不是不可以加入其中已经存在的某条最短路中,使之更短就可以了 1 #include <stdio.h> 2 #include <stdlib.h> 3 int N,K; 4 int mat[302][302]; 5 int calc() 6 { 7 int i,j; 8 int sum=0; 9 for(i=1;i<=N;i++)10 for(j=i+1;j<=N;j++)11 sum+=mat[i][j];12 ... 阅读全文
posted @ 2011-12-09 09:59 linyvxiang 阅读(258) 评论(0) 推荐(0)