| ||||||||||
| 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<stdio.h>
int main()
{
int n,m,i,j,k,l,q,w,e;
while(~scanf("%d",&n))
{
int sum=0;
for(i=1;;i++)
{
sum+=i;
if(sum>=n) break;
}
sum-=i;
i--;
int a,b;
if(i%2==0)
{
b=n-sum;
a=i+2-b;
printf("TERM %d IS %d/%d\n",n,a,b);
}
else
{
a=n-sum;
b=i+2-a;
printf("TERM %d IS %d/%d\n",n,a,b);
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator