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 |
水过100题,留念!贴个代码: #include<cstdio> #include<cstring> #include<iostream> using namespace std; int score[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(void) { int test,v=0; cin>>test; while(test--) { int sum,n = 0; cin>>sum; for(int i=0;i<63;++i) for(int j=i;j<63;++j) for(int k=j;k<63;++k) if(score[i]+score[j]+score[k]==sum) n++; cout<<"Scenario #"<<++v<<":"<<endl; cout<<n<<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