上一页 1 ··· 5 6 7 8 9
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1256分析:能被11整除的数具有什么特性呢?原来是奇数位与偶数位之差的绝对值是11的倍数。能被3和11整除吗 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int t,s,s1,s2,s3,i; 6 char a[210]; 7 scanf("%d",&t); 8 while(t--) 9 {10 s=s1=s2=0;11 scanf("%s",a);12 . 阅读全文
posted @ 2013-05-31 20:48 EtheGreat 阅读(145) 评论(0) 推荐(0)
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1816 阅读全文
posted @ 2013-05-31 20:36 EtheGreat 阅读(249) 评论(0) 推荐(1)
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1846分析:设置front记录前一个单词即可,容易题。Angry Grammar Nazi 1 #include<stdio.h> 2 #include<string.h> 3 int lol(char string[105]) 4 { 5 int i,len; 6 len=strlen(string); 7 for(i=0;i<len-2;i++) 8 { 9 if(string[i]=='l'&&string[i+1]=='o&# 阅读全文
posted @ 2013-05-31 20:27 EtheGreat 阅读(170) 评论(0) 推荐(0)
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1849分析:设置一个ori变量记录房间里原有人数。Negative People in Da House 1 #include<stdio.h> 2 int main() 3 { 4 int T,t,M,a,b,i,ori,sum; 5 scanf("%d",&T); 6 while(T--) 7 { 8 sum=0;ori=0; 9 scanf("%d",&M);10 for(i=1;i<=M;i++)11 ... 阅读全文
posted @ 2013-05-31 20:18 EtheGreat 阅读(179) 评论(0) 推荐(0)
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1850 1 #include<cstdio> 2 #include<algorithm> 3 #include<iostream> 4 using namespace std; 5 int main() 6 { 7 int T,W,M,num[105],ans,i,flag; 8 scanf("%d",&T); 9 while(T--)10 {11 ans=0;flag=0;12 scanf("%d %d",&W 阅读全文
posted @ 2013-05-31 20:12 EtheGreat 阅读(140) 评论(0) 推荐(0)
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1852分析:分情况讨论即可。 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int T,x,y,i,j,temp; 6 char cell[105][105]; 7 scanf("%d",&T); 8 while(T--) 9 {10 scanf("%d%d",&x,&y);11 getchar();12 memset(cell,0,sizeo 阅读全文
posted @ 2013-05-31 20:05 EtheGreat 阅读(166) 评论(0) 推荐(0)
摘要: 原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=25201串 1 #include<stdio.h> 2 int len[45]={0}; 3 int Len(int m) 4 { 5 return len[m]=len[m]>0?len[m]:Len(m-1)+Len(m-2); 6 } 7 int main() 8 { 9 int T,m;10 scanf("%d",&T);11 len[1]=2;len[2]=3;12 Len(40);13 while(T--)14 {15 ... 阅读全文
posted @ 2013-05-28 00:16 EtheGreat 阅读(116) 评论(0) 推荐(0)
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1668 由于题目意思指的是将分数拆分成不同的单位分数之和,所以就不用考虑将2/3拆成1/3+1/3这种情况了;又由于好的拆分要求项数即len要少,最小的项要大,故可以采用迭代加深搜索,按项数不断增大的顺序进行搜索;对每一种len,要用一个数组将其的所有情况记录下来,但这样太耗空间了,因此将情况保存在ans数组里,然后对ans不断进行更新。具体实现时,要设两个标志flag,flag1,flag用来判断是不是第一次搜索len长的拆分,flag1用来判断是否需要对ans进行更新。还有就是每次搜索的起点要弄.. 阅读全文
posted @ 2013-05-25 19:53 EtheGreat 阅读(249) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9