Can any one help me to find out , why i getting presentation error ???
several times i submit this code, but every time i got presentation error.
Please help me ...........
Here is my code,
Code: Select all
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int compair(const void *a, const void *b){
float *x = (float*)a ;
float *y = (float*)b ;
if(*x > *y) return 1 ;
if(*x < *y) return -1 ;
return 0;
}
int main(){
int n, m, x, y, i, j ;
float a[1000], b[1000] ;
bool xy[1000] ;
scanf("%d",&n);
while(n--){
scanf("%d",&m);
memset(xy,true,sizeof(xy));
for(i=0; i<m; i++){
scanf("%d %d",&x,&y);
a[i] = x / (float)y ;
b[i] = a[i] ;
}
qsort(a, m, sizeof(a[0]), compair);
for(i=0; i<m; i++){
for(j=0; j<m; j++){
if(xy[j]){
if(a[i]==b[j]){
if(i==0)
printf("%d",j+1) ;
else
printf(" %d",j+1) ;
xy[j] = false;
}
}
}
}
printf("\n");
if(n > 0)
printf("\n");
}
return 0;
}