| ||||||||||
| 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 | |||||||||
why wrong anser?it runs nice in the vc compiler.#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator