-
Notifications
You must be signed in to change notification settings - Fork 0
/
10141.cpp
76 lines (62 loc) · 1019 Bytes
/
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include<iostream>
#include<string>
#include<set>
using namespace std;
int main()
{
int cnt = 1;
while (1)
{
int n, p;
set<string> s;
cin >> n >> p;
if (n == 0 && p == 0)
break;
if (cnt != 1)
printf("\n");
cin.ignore();
cin.ignore();
for (int i = 0; i < n; i++)
{
string tmp;
getline(cin, tmp);
s.insert(tmp);
}
//for (auto itr = s.begin(); itr != s.end(); itr++)
// cout << *itr << ", ";
//cout << endl;
string ans;
double compliance=0, price=2000000000;
for (int i = 0; i < p; i++)
{
string tmp;
getline(cin, tmp);
double _p, c;
double nn;
cin >> _p >> nn;
cin.ignore();
for (int i = 0; i < nn; i++)
{
string ss;
getline(cin, ss);
}
c = nn / n;
if (c > compliance)
{
ans = tmp;
compliance = c;
price = _p;
}
else if (c == compliance && _p < price)
{
ans = tmp;
compliance = c;
price = _p;
}
}
printf("RFP #%d\n%s\n", cnt, ans.c_str());
cnt++;
}
return 0;
}
//AC