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