Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
两个比较 WA 和AC的#include<iostream> using namespace std; int main() { int a,i,j,k,p,sum1,sum2,sum3; for(a=2992;a<10000;a++) { sum1=0;sum2=0;sum3=0;i=a;j=a;k=a;p=a; while(k<10) { sum1+=k%10; k/=10; } while(i<12) { sum2+=i%12; i/=12; } while(j<16) { sum3+=j%16; j/=16; } if((sum1==sum2)&&(sum2==sum3)) cout<<p<<endl; } system("pause"); return 0; } #include<iostream> using namespace std; int main() { int a,i,j,k,p,sum1,sum2,sum3; for(a=2992;a<10000;a++) { sum1=0;sum2=0;sum3=0;i=a;j=a;k=a;p=a; sum1+=i%10; i/=10; sum1+=i%10; i/=10; sum1+=i%10; i/=10; sum1+=i%10; sum2+=j%16; j/=16; sum2+=j%16; j/=16; sum2+=j%16; j/=16; sum2+=j%16; sum3+=k%12; k/=12; sum3+=k%12; k/=12; sum3+=k%12; k/=12; sum3+=k%12; if((sum1==sum2)&&(sum2==sum3)) cout<<p<<endl; } system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator