| ||||||||||
| 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>
#include <math.h>
void main(){
int n,j,i;
scanf("%d",&n);
while(n>=1&&n<=10000){
i=1;
j=n-i;
while(j>i){
i++;
j=j-i;
}
printf("%d %d",j,i);
if(i%2==1){
if(j!=0){
printf("TERM %d IS %d/%d\n",n,j,i+2-j);}
else{
printf("TERM %d IS 1/%d\n",n,i);}
}
else{
if(i%2==0){
if(j!=0){
printf("TERM %d IS %d/%d\n",n,i+2-j,j);}
else{
printf("TERM %d IS %d/1\n",n,i);}
}
}
scanf("%d",&n);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator