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

why wrong anser?it runs nice in the vc compiler.

Posted by pkueducn1 at 2005-01-10 14:31:52 on Problem 2051
#include<stdio.h>
void main(){
	int a[1001][2],i,j,m,temp0,temp1,b,count=0;
	char c;
	scanf("%c",&c);
	for(i=1;c!='#';i++){
		scanf("gister ");
		scanf("%d %d\n",&a[i][0],&a[i][1]);
		scanf("%c",&c);
	}
	b=i-1;
	scanf("\n%d",&m);
	for(i=1;i<b;i++)
		for(j=1;j<=b-i;j++)
			if(a[j][0]>a[j+1][0]){
				temp0=a[j][0];a[j][0]=a[j+1][0];a[j+1][0]=temp0;
				temp1=a[j][1];a[j][1]=a[j+1][1];a[j+1][1]=temp1;
			}
	for(i=1;;i++){
		for(j=1;j<=b;j++)
			if(i%a[j][1]==0){
				count++;
				if(count>m) break;
				printf("%d\n",a[j][0]);
			}
		if(count>=m) break;
	}
}



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