#12778: uva過了但這邊WA


k034006 (Sine Wu)

學校 : 高雄市立高雄高級中學
編號 : 46921
來源 : [140.112.230.10]
最後登入時間 :
2024-04-08 03:46:24
a673. 10026 - Shoemaker's Problem -- UVa10026 | From: [219.85.95.249] | 發表日期 : 2017-10-04 13:30

#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string.h>
#include<memory.h>
#include<iostream>
using namespace std;
struct D{
  int cur;
  int x,y;
};
inline bool cmp(D s,D t){
  return s.y*t.x>t.y*s.x;
}
int main(){
  int T,n;
  D a[1000];
  scanf("%d",&T);
  while(T--){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
      scanf("%d%d",&a[i].x,&a[i].y);
      a[i].cur=i;
    }
    sort(a,a+n,cmp);
    printf("%d",a[0].cur+1);
    for(int i=1;i<n;i++){
      printf(" %d",a[i].cur+1);
    }
    T?puts("\n"):puts("");
  }
  return 0;
}

 
ZeroJudge Forum