-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoj0240.cpp
53 lines (49 loc) · 1001 Bytes
/
aoj0240.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;
const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
struct edge{int to,cost;};
int b[50],r[50],t[50];
int y;
double motori(int i){
if(t[i]==1){
return (double)y*r[i]/100 + 1;
}else{
return pow(1+(double)r[i]/100, y);
}
}
int main(){
int n;
while(cin >> n, n){
cin >> y;
for(int i=0;i<n;i++){
cin >> b[i] >> r[i] >> t[i];
}
int max_i = 0;
double max_m = motori(0);
for(int i=1;i<n;i++){
double m = motori(i);
if(m>max_m){
max_i = i;
max_m = m;
}
}
cout << b[max_i] << endl;
}
return 0;
}