Advertisement
Plabon_dutta

UVA 10141 - Request for Proposal

Mar 26th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n, p, i, j, t=1;
  7.     while(1) {
  8.         scanf("%d %d%*c", &n, &p);
  9.         if(n==0 && n==p) break;
  10.         char str[82];
  11.         for(i=0; i<n; i++) scanf("%[^\n]%*c", &str);
  12.         char acnam[82];
  13.         int acno=0;
  14.         float acpr=0;
  15.         for(i=0; i<p; i++) {
  16.             char name[82];
  17.             int no=0;
  18.             float pr=0;
  19.             scanf("%[^\n]%*c", &name);
  20.             scanf("%f %d%*c", &pr, &no);
  21.             for(j=0; j<no; j++) scanf("%[^\n]%*c", &str);
  22.             if(acno<no) {
  23.                 strcpy(acnam,name);
  24.                 acno=no;
  25.                 acpr=pr;
  26.             }
  27.             else if(acno==no) {
  28.                 if(pr<acpr) {
  29.                     strcpy(acnam,name);
  30.                     acno=no;
  31.                     acpr=pr;
  32.                 }
  33.             }
  34.         }
  35.         if(t>1) printf("\n");
  36.         printf("RFP #%d\n%s\n", t++, acnam);
  37.     }
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement