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

简单模拟~~~G++0ms水

Posted by wtl666wtl at 2016-02-26 10:00:31 on Problem 2000
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,k,z;
int main ()
{
	while (scanf("%d",&n)!=EOF) {
		if(n==0)break;
		printf("%d ",n);
		z=1;
		k=0;
		m=0; 
		for (int i=1; i<=n; i++) {
			k++;
			if(k>z) {
				z++;
				k=1;
			}
			m=m+z;
		}
		printf("%d\n",m);
	}
	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