| ||||||||||
| 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 | |||||||||
谁能帮我看看是哪儿错了,呜呜呜,我找不出来啊
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator