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 wocha at 2012-05-01 14:06:35 on Problem 1969
#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:
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