| ||||||||||
| 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 | |||||||||
我这样写了,可怎么还不过呢?老师也没看出来啊!In Reply To:1969题的"The input list contains a single number per line and will be terminated by endof-file."是指以什么结尾啊? Posted by:tiankong at 2004-11-22 14:16:04 #include <stdio.h>
void main()
{
int a[100],i,n,sum,son,mom;
while( scanf("%d",&n)==1 )
{
sum=0;
for(i=1;i<100;i++)
{
a[i]=i;
sum+=a[i];
if(sum>=n)break;
}
if(i%2==0)
{
son=i-(sum-n);
mom=i+1-son;
printf("TERM %d IS %d/%d\n",n,son,mom);
}
else
{
son=sum-n+1;
mom=i+1-son;
printf("TERM %d IS %d/%d\n",n,son,mom);
}
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator