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 |
Re:穷举行吗??似乎会tle啊In Reply To:穷举行吗??似乎会tle啊 Posted by:hello1807 at 2009-04-04 19:19:04 可以的 #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 result; int main() { int casecount=0; cin>>casecount; for(int i=1;i<=casecount;i++) { result=0; int temp; cin>>temp; for(int j=0;j<63;j++) for(int k=j;k<63;k++) for(int m=k;m<63;m++) if(score[j]+score[k]+score[m]==temp) result++; cout << "Scenario #" << i << ":" << endl; cout << result << endl; cout << 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