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

纯数学解法...

Posted by jmf at 2010-01-24 18:52:14 on Problem 3086
#include <iostream>

using namespace std;

int main ()
{
	int n,k[999];
	cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>k[i];
		int w=0;
		for (int j=1;j<=k[i];j++)
		{
			w+=j*(j+1)*(j+2)/2;
		}
		cout<<i+1<<" "<<k[i]<<" "<<w<<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