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 dodototo at 2010-02-01 09:58:26 on Problem 1969
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int t,s,q,i;
	float I,k;
	while(scanf("%f", &k) != EOF)
	{
        I=sqrt(2*k)-1;
		//cout<<I<<endl;
		for(i=I/1-1;i<=k;i++)
		{
			t=(i+1)*i/2;
			if(t>=k)
				break;
		}
		s=k-(i*(i-1)/2);
		q=i+1-s;
		if(i%2==0)
			cout<<"TERM "<<k<<" IS "<<s<<"/"<<q;
		else
			cout<<"TERM "<<k<<" IS "<<q<<"/"<<s;
		cout<<endl;
	}
	return(0);
}

			

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