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 zzzzzz at 2004-11-24 15:29:46 on Problem 1969
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:
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