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 |
代码#include<iostream> using namespace std; int s[63]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40, 3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,25,50}; int main() { int n,m; cin>>n; int l=1; __int64 total=0; while(l<=n) { total=0; cin>>m; cout<<"Scenario #"<<l<<":"<<endl; for (int i=0;i<63;i++) { int m1; if (m>=s[i]) { m1=m-s[i]; for (int j=i;j<63;j++) { int m2; if(m1>=s[j]&&j>=i) { m2=m1-s[j]; for (int k=j;k<63;k++) { int m3=-1; if (m2>=s[k]) { m3=m2-s[k]; } if (m3==0&&k>=j) { total++; } } } } } } l++; cout<<total<<endl<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator