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 |
用数学的方法为什么WA??#include<stdio.h> #include<math.h> void main() { int i,n,k,sum; scanf("%d",&k); while(k--) { scanf("%d",&n); i=(int)sqrt(2*n); if(i*(i+1)/2-n<0) i++; sum=i-i*(i+1)/2+n; printf("%d\n",sum); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator