summaryrefslogtreecommitdiff
path: root/rfp/rfp.cpp
diff options
context:
space:
mode:
authorAditya Naik2018-05-09 21:44:24 -0400
committerAditya Naik2018-05-09 21:44:24 -0400
commitc6e35f76dfe3eefddd64ca64dda3ab1449048464 (patch)
tree21c7ccca9f1fc8a4a575508a5ba109da513d4c59 /rfp/rfp.cpp
initial
Diffstat (limited to 'rfp/rfp.cpp')
-rw-r--r--rfp/rfp.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/rfp/rfp.cpp b/rfp/rfp.cpp
new file mode 100644
index 0000000..2a4f918
--- /dev/null
+++ b/rfp/rfp.cpp
@@ -0,0 +1,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;
+}