摘要: #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)