-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10141.cpp
56 lines (45 loc) · 1.2 KB
/
10141.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
54
55
56
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main(int argc, char const *argv[])
{
int product, member, met, met_tmp, index = 1;
double price, price_tmp;
string win, name;
char tmp;
bool flag;
flag = false;
while (1) {
cin >> product >> member;
if (product < 1) break;
if (flag)
cout << endl;
else
flag = true;
for (int i = 0; i < product; ++i) {
tmp = getchar();
while (getchar() != '\n')
;
// cin.ignore(81, '\n');
}
met = 0;
for (int i = 0; i < member; ++i) {
cin >> name >> price_tmp >> met_tmp;
for (int j = 0; j < met_tmp; ++j) {
tmp = getchar();
while (getchar() != '\n')
;
// cin.ignore(81, '\n');
}
if (met_tmp > met || (met_tmp == met && price_tmp < price)) {
win = name;
price = price_tmp;
met = met_tmp;
}
}
cout << "RFP #" << index++ << endl;
cout << win << endl;
}
return 0;
}