Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:乱来的代码

Posted by 1106100029 at 2012-02-28 20:28:31 on Problem 2000
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator