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

哪位大牛帮我看看1969, 实在不知道哪有错!!!!

Posted by woshiniya at 2006-05-09 21:38:31
#include <iostream>
using namespace std;

void main() {
	int i, in;
	long sum, t;
	while(cin >> t) {
		if(cin.eof())
			break;
		if(t <= 0 )
			continue;
		sum = 0;
		i = 1;
		cout <<"TERM " << t << " IS ";
		while(sum < t){
			sum += i;
			i++;
		}
		in = t + i - 1 -  sum;
		if(i % 2 == 1)
			cout << in << '/' << i - in << endl;
		else
			cout << i - in  << '/' << in << 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