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 |
第一百题,木有看过discuss,纯手工制作,随便写写吧#include <cstdio> int f(int n){return n*(n-1)/2;} int main() { int T; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); int ans=n-2; if(n%2==0)ans=ans+f((n-2)/2)*2; else ans=ans+f((n-3)/2)+f((n-3)/2+1); printf("%d\n",ans); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator