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<iostream.h> void main() { double a[10000],b; int j; a[0]=1; for(int i=1;i<10000;i++) { a[i]=i+1+a[i-1]; } while(cin>>b) { if(b==1) cout<<"TERM 1 IS 1/1"<<endl; else{ for(j=0;;j++) { if(a[j]>=b) break; } if((j+2)%2==0) { cout<<"TERM "<<b<<" IS "<<j+2-b+a[j-1]<<"/"<<b-a[j-1]<<endl; } if((j+2)%2!=0) { cout<<"TERM "<<b<<" IS "<<b-a[j-1]<<"/"<<j+2-b+a[j-1]<<endl; } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator