Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, p, i, j, t=1;
- while(1) {
- scanf("%d %d%*c", &n, &p);
- if(n==0 && n==p) break;
- char str[82];
- for(i=0; i<n; i++) scanf("%[^\n]%*c", &str);
- char acnam[82];
- int acno=0;
- float acpr=0;
- for(i=0; i<p; i++) {
- char name[82];
- int no=0;
- float pr=0;
- scanf("%[^\n]%*c", &name);
- scanf("%f %d%*c", &pr, &no);
- for(j=0; j<no; j++) scanf("%[^\n]%*c", &str);
- if(acno<no) {
- strcpy(acnam,name);
- acno=no;
- acpr=pr;
- }
- else if(acno==no) {
- if(pr<acpr) {
- strcpy(acnam,name);
- acno=no;
- acpr=pr;
- }
- }
- }
- if(t>1) printf("\n");
- printf("RFP #%d\n%s\n", t++, acnam);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement