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

运行已经很正确,为什么总是wrong answer????

Posted by 90405129 at 2004-12-23 20:13:17 on Problem 1969
#include<stdio.h>
#include<math.h>
int i,j,n,p,q,s=0;
void main(){
	scanf("%d",&n);
	if(n="\n")break;
	for(i=1;;i++){
		s=s+i;
		if(s==n||(n<s&&n>s-i)){j=i;break;}
	}
	if(j%2==0){
		s=s-j;p=n-s;q=j+1-p;
		printf("TERM %d IS %d/%d\n",n,p,q);
		}
	else{
		s=s-j;q=n-s;p=j+1-q;
        printf("TERM %d IS %d/%d\n",n,p,q);	
}




	   

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