blob: 2a4f918a8520ed5d2a93b9b013340c24dfec30e1 (
plain)
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
|
#include <iostream>
#include <string>
using namespace std;
int main(){
float req, pro;
cin>>req>>pro;
int rfpnum=0;
while(req>0)
{
int i, j, k;
float cost,curcost=1000000000, comp, curcomp=0, numcomp;
string trash, curname, name;
++rfpnum;
for(i=0; i<=req; i++)
getline(cin, trash);
for(j=0; j<pro; j++){
getline(cin, name);
cin>>cost>>numcomp;
comp = numcomp/req;
if(comp>curcomp || (comp==curcomp && cost<curcost)){
curname = name;
curcomp = comp;
curcost = cost;
}
for(k=0;k<=numcomp;k++)
getline(cin, trash);
}
if(rfpnum>1) cout<<"\n";
cout<<"RFP #"<<rfpnum<<"\n"<<curname<<"\n";
cin>>req>>pro;
}
return 0;
}
|