Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

顺序不是分奇偶的吗?

Posted by frkstyc at 2005-04-17 00:49:23 on Problem 1969
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator