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 |
顺序不是分奇偶的吗?In Reply To:高人指点一下,为什么wa Posted by:huk at 2005-04-17 00:38:33 > #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