Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Why WA?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator