摘要:
#include<iostream>#include<string>#include<cmath>using namespace std;int main(){ string s; while(cin>>s) { if(s=="0")break; int len=s.length(),i; long long sum=0; for(i=len;i>0;i--) { sum+=(s[len-i]-'0')*((int)pow(2.0,i*1.0)-1); } ... 阅读全文
摘要:
#include<iostream>using namespace std;int main(){ int m,n; while(cin>>m>>n) { cout<<m*n-1<<endl; } return 0;} 阅读全文
摘要:
#include<iostream>#include<cmath>using namespace std;int main(){ int n; while(cin>>n) { unsigned long long a[10]={0}; int i,j; for(i=1;i<=n;i++) { a[0]+=i*i; } a[1]=(n*(n+1)/2)*(n*(n+1)/2); a[1]=a[1]-a[0]; for(i=1;i<=n;i++)... 阅读全文
摘要:
#include<iostream>#include<cmath>using namespace std;int main(){ long long n; while(cin>>n) { if(n==0)break; n=(n-1960)/10+2; double flag1=pow(2.0,n+0.0)*log10(2.0); double flag2=0.0; for(int i=1;;i++) { flag2+=log10(i+0.0); i... 阅读全文
摘要:
#include<iostream>using namespace std;int main(){ long long m,n,flag=1; while(cin>>m>>n) { if(m==0&&n==0)break; long long sum=0; sum=m*(m-1)*n*(n-1)/4; cout<<"Case "<<flag++<<": "<<sum<<endl; }} 阅读全文
摘要:
#include<iostream>using namespace std;int main(){ int sum; cin>>sum; while(sum--) { int m,n; int flag1,flag2; cin>>m>>n; flag1=m/3; flag2=n/3; cout<<flag1*flag2<<endl; } return 0;} 阅读全文
摘要:
#include<iostream>#include<cstdio>using namespace std;int main(){ int k; int a[10010]; int b[10010]={0}; while(cin>>k) { int flag=0,j,r,temp; char c; while(scanf("%d%c",&temp,&c)==2) { a[flag++]=temp; if(c=='\n')break; } ... 阅读全文
摘要:
#include<iostream>using namespace std;int main(){ int H,U,D,F; while(cin>>H>>U>>D>>F) { if(H==0)break; int i; double temp=double(U)*(F/100.0); double sum=U; for(i=1;;i++) { if(sum>H) { cout<<"success on day "<<i... 阅读全文
摘要:
#include<iostream>using namespace std;int main(){ int sum; cin>>sum; while(sum--) { int m,n,i; cin>>m>>n; int dis=n-m; if(dis==0) cout<<"0"<<endl; else { for(i=0;;i++) { if(dis==i*i) ... 阅读全文
摘要:
#include<iostream>#include<cstdio>using namespace std;int main(){ int n; double s; while(cin>>n) { if(n<0)break; if(n<=1)s=0; else s=n; s=s*25.0; printf("%.lf%%\n",s); } return 0;} 阅读全文