摘要: #include <iostream>#include <string>using namespace std;int main(){int N;cin>>N;while(N>0){string word;cin>>word;int a;cin>>a;int temp;for(int j=0;j<a;j++){int b;cin>>b;if(j==0){temp=b;continue;}if(word=="Faster"){if(temp>b)temp=b;}if(word==&quo 阅读全文
posted @ 2012-05-25 22:16 梨子 阅读(128) 评论(0) 推荐(0)
摘要: #include <iostream>#include <string>using namespace std;int main(){string in;int all,del,a;int length;while(cin>>in&&in!="0"){del=0;all=(in[0]-'0')*2;length=in.length();for(int i=1;i<length;i++){a=in[i]-'0';all=all*2+a*2;del=del+a;}all=all-del-( 阅读全文
posted @ 2012-05-25 12:48 梨子 阅读(110) 评论(0) 推荐(0)
摘要: #include <iostream>using namespace std;int main(){int n;int *a=new int[n];while(cin>>n&&n){ int i; int count1=0; int count2=0; for(int j=0;j<n;j++) cin>>a[j]; for( i=1;i<n;i++) { if(i%2==0&&a[i]!=a[0]) { count1++; continue; } if(i%2==1&&a[i]==a[0]) { c 阅读全文
posted @ 2012-05-25 12:08 梨子 阅读(146) 评论(0) 推荐(0)
摘要: #include <iostream>#include <string>using namespace std;int reverse(int k){int rev=0;while(k>0){rev=rev*10+k%10;k=k/10;}return rev;}int main(){int a,b,c,n;cin>>n;while(n>0){cin>>a>>b;a=reverse(a);b=reverse(b);c=a+b;c=reverse(c);cout<<c<<endl;n--;}retur 阅读全文
posted @ 2012-05-25 12:03 梨子 阅读(128) 评论(0) 推荐(0)
摘要: #include <iostream>using namespace std;int main(){int n;int a0;int a1;int a2;while(cin>>n){if(n<0)break;a0=7;a1=11;a2=0;int i=2;if(n==0||n==1){cout<<"no"<<endl;continue;}n%8 == 2 || n%8 == 6? cout << "yes"<<endl: cout << "no" 阅读全文
posted @ 2012-05-22 12:53 梨子 阅读(148) 评论(0) 推荐(0)
摘要: #include <iostream>using namespace std;int main(){double a;while(cin>>a){if(a==0)break;double b=0;double n=1;while(b<a){double c=1/(n+1);b=b+c;n++;}cout<<n-1<<" card(s)"<<endl;}return 0;} 阅读全文
posted @ 2012-05-22 12:22 梨子 阅读(114) 评论(0) 推荐(0)
摘要: #include <iostream>#include <cmath>using namespace std;int main(){double B, N;while(cin>>B>>N&&B&&N){int A=0;A=pow(double (B),double(1/N));if((B-pow(A,N))<(pow(A+1,N)-B))cout<<A<<endl;elsecout<<A+1<<endl;}return 0;} 阅读全文
posted @ 2012-05-22 12:20 梨子 阅读(95) 评论(0) 推荐(0)
摘要: #include <iostream>using namespace std;int main(){int n;cin>>n;int all;while(n>0){all=0;int k;cin>>k;int m;for(int i=0;i<k;i++){cin>>m;all=all+m;}cout<<all-k+1<<endl;n--;}return 0;} 阅读全文
posted @ 2012-05-22 12:19 梨子 阅读(123) 评论(0) 推荐(0)
摘要: #include <iostream>using namespace std;int n;struct countandtime{int count;int time;};countandtime *divideandcount=new countandtime[n];int com(int sum1,int len)//计算结果{long all=1;for(int a=0;a<len;a++){long all1=1;long h=1;//重复时再除的数for(int b=1;b<=divideandcount[a].time;b++){long c=1;//分子l 阅读全文
posted @ 2012-05-11 21:46 梨子 阅读(194) 评论(0) 推荐(0)
摘要: #include <iostream>#include <string>using namespace std;int main(){string str;int count=0;while(cin>>str){if(str=="<br>"){cout<<endl;count=0;continue;} if(str=="<hr>"){if(count>0)cout<<endl;for(int i = 0; i < 80; i++) cout << 阅读全文
posted @ 2012-05-08 12:35 梨子 阅读(132) 评论(0) 推荐(0)