标签:style http color os io ar for 2014 cti
根据题意可以得到,长度小,并且频率低的排到前面,所以设 k = l / q;
之后sort排序就可以
| 14128675 | 1346 | Songs | Accepted | C++ | 0.029 | 2014-09-01 11:30:14 |
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
const double eps = 1e-10;
#define MAXD 100000 + 10
#define _PI acos(-1.0)
struct Pow{
double k;
int n;
double L;
double Hz;
friend bool operator <(Pow p,Pow q){
return p.k < q.k;
}
}value[MAXD];
int main(){
int n;
while(scanf("%d",&n) != EOF){
for(int i = 0 ; i < n ; i++){
scanf("%d%lf%lf",&value[i].n,&value[i].L,&value[i].Hz);
value[i].k = 1.0 * value[i].L / value[i].Hz;
}
sort(value,value + n);
int t;
scanf("%d",&t);
printf("%d\n",value[t - 1].n);
}
return 0;
}
标签:style http color os io ar for 2014 cti
原文地址:http://blog.csdn.net/u013451221/article/details/38984299