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:乱来的代码In Reply To:乱来胡 Posted by:1106100029 at 2012-02-28 20:28:02 #include <iostream> using namespace std; int main(){ int n,m, goal = 0; int x,i,j,l = 1; for(i=0; i<21; i++){ cin>>n; if(n==0) break; while(1){ m = 1; for(m=1; m<=n;){ for(j=1; j<=m; j++){ goal += m; l++; if(l>n) break; } if(l>n) break; m++; } break; } cout<<n<<" "<<goal<<endl; goal = 0; l = 1; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator