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

不要打表 给你看看我的代码 216K 0ms 229B的(简单的数学计算)

Posted by ylllxw08 at 2009-08-11 15:18:09 on Problem 2000 and last updated at 2009-08-11 15:18:31
In Reply To:呵呵,打了个小表,有点遗憾啊,虽然过了 Posted by:kirsten0302 at 2009-08-03 18:25:11
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int k,m,n;
	while(cin>>n&&n)
	{
		k=sqrt(double(2)*n+0.25)-0.5;
		m=n-k*(k+1)/2;
		cout<<n<<' '<<m*(k+1)+k*(k+1)*(2*k+1)/6<<endl;
	}
	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