努力ing
你浪费的今天是昨天死去的人所渴望的明天!!!
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1283#include<iostream>#include<string>using namespace std;int main(){ int m1,m2; string str; while(cin>>m1>>m2>>str) { int r1=0,r2=0,r3=0,i; int t=str.length(); for(i=0;i<t;i++) { if(str[i]=='A') {r1=m1;continue;} if( 阅读全文
posted @ 2013-05-30 22:32 努力ing 阅读(124) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1013题目简述:输入一串数字,求它的根,根的定义:将各位数字相加,如果和小于10,则为根,否则,继续将和的各位数相加,知道和小于10.Input24390Output63代码:解释(sum-1)%9+1;如果要将一个数n变成1~9之间的数,(n-1)%9+1就行了举个例子吧!假如输入的数是7896768;可以这样做:(7+8+9+6+7+6+8-1)%9+1=6;代码:#include<iostream>#include<string>using namespace std;int m 阅读全文
posted @ 2013-05-30 20:55 努力ing 阅读(161) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1002#include<iostream>#include<string>using namespace std;int main(){ int n; scanf("%d",&n); int i; for(i=1;i<=n;i++) { string str1,str2; cin>>str1>>str2; int a[1010]={0},b[1010]={0},c[1010]={0}; int j,k; int alen=str 阅读全文
posted @ 2013-05-30 20:43 努力ing 阅读(134) 评论(0) 推荐(0)
摘要: #include<iostream>#include<string>using namespace std;int main(){ int i,j,n; while(cin>>n&&n) { string str[1005]; int num[1005]={0}; for(i=0;i<n;i++) { cin>>str[i]; for(j=0;j<=i;j++) { if(str[i]==str[j]) num[j]++; } } int max=-1; int k; for(i=0;i<n;i++) if(ma 阅读全文
posted @ 2013-05-30 20:42 努力ing 阅读(99) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1088字符串问题第一种方法#include<iostream>#include<string>using namespace std;int main(){ string str; int i,num=0; while(cin>>str) { if(str=="<br>") { cout<<endl; num=0; continue; } if(str=="<hr>") { if(num!=0) c 阅读全文
posted @ 2013-05-30 20:40 努力ing 阅读(204) 评论(0) 推荐(0)