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 wrong answer?#include<math.h> #include<stdio.h> #define N "TERM %d IS %d/%d\n" void main(){ long n,k,j; while(scanf("%d",&n)!=EOF) { k=sqrt(n)+1; j=n-k*(k+1)/2; while(j<0){k--;j=n-k*(k+1)/2;} while(j>k){k++;j-=k;} if(!j)printf(N,n,k,1); else { if(k%2)printf(N,n,j,k-j+2); else printf(N,n,k+2-j,j); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator