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

Why WA?

Posted by 00 at 2005-04-11 19:50:02 on Problem 1455
#include<iostream.h>
int n;
void main()
{
	int t;
	cin>>t;
	long *a;
	a=new long[t];
	for(int i=0;i<t;i++)
	{
		cin>>n;
		if(n%2==1)
			a[i]=(n/2+1)*(n/2)/2+n/2*(n/2-1)/2;
		if(n%2==0&&n!=2)
			a[i]=n/2*(n/2-1);
		if(n==2)
			a[i]=1;
	}
	for(i=0;i<t;i++)
		cout<<a[i]<<endl;
	delete [] a;
}

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