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 |
运行已经很正确,为什么总是wrong answer????#include<stdio.h> #include<math.h> int i,j,n,p,q,s=0; void main(){ scanf("%d",&n); if(n="\n")break; for(i=1;;i++){ s=s+i; if(s==n||(n<s&&n>s-i)){j=i;break;} } if(j%2==0){ s=s-j;p=n-s;q=j+1-p; printf("TERM %d IS %d/%d\n",n,p,q); } else{ s=s-j;q=n-s;p=j+1-q; printf("TERM %d IS %d/%d\n",n,p,q); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator