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

Re:麻烦哪位高手看一看,所有的变态数据都正确,但提交结果总是WA

Posted by ssfp8762 at 2009-02-22 23:33:32 on Problem 1001
In Reply To:麻烦哪位高手看一看,所有的变态数据都正确,但提交结果总是WA Posted by:805840887 at 2009-02-18 09:17:27
> #include<stdio.h>
> int main(){
> 	int s,i,j,n[15];
> 	long int r[15],x[15],f;
> 	double R[15],t;
> 	int a[15][1000],d;
> 	printf("计算R的n次方:\n");
> 	printf("(若R的值或n的值为负,结束.)\n");
> 	for(s=0;s<6;s++){
> 		for(i=0;i<1000;i++) a[s][i]=0;a[s][0]=1;
> 	}
> 	for(s=0;s<6;s++){
> 		scanf("%lf %d",&R[s],&n[s]);
> 		printf("\n");
> 		t=100000*R[s]-(int)(100000*R[s]);
> 		if(t>0.5) r[s]=(int)(100000*R[s])+1;
> 		else r[s]=(int)(100000*R[s]);
> 	}
> 	for(s=0;s<6;s++){
> 		d=7;j=0;
> 		for(i=1;i<=n[s];i++){
> 			for(f=0,j=0;j<=d;j++){
> 				x[s]=a[s][j]*r[s]+f;f=x[s]/10;a[s][j]=x[s]%10;
> 			}
> 			while(a[s][j]==0) j--;d=j+50;
> 		}
> 		while(a[s][j]==0&&j>=0) j--;
> 		for(i=0;a[s][i]==0&&i<j;i++);
> 		if(j<5*n[s]&&j>=0) j=5*n[s];
> 		if(j>=0){
> 			for(;j>=i;j--){
> 				if(j==5*n[s]&&j!=i) printf("%d.",a[s][j]);
> 				else printf("%d",a[s][j]);
> 			}
> 		}
> 		else printf("0");
> 		if(i>5*n[s]){for(j=0;j<i-5*n[s];j++) printf("0");}
> 		printf("\n");
> 	}
> 	return 0;
> }
> 我不知道如何结束输入,他说的与我用的双精度不一样,所以按照他给的测试数据,我指定的是输入组数据。

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