Advertisement
Farjana_akter

Untitled

Feb 7th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int t=0,a,b,c,i,x=0,k,j;
  7. string item1,item2,com1,com2;
  8. double price;
  9. while(1)
  10. {
  11. cin>>a>>b;
  12. if(a==0 || b==0)
  13. break;
  14. if(t>0)
  15. cout<<endl;
  16. for(i=0;i<a;i++){
  17. scanf(" ");
  18. getline(cin,item1);
  19. }
  20. int max=0;
  21. double min=100000000;
  22. for(k=0;k<b;k++)
  23. {
  24. getline(cin,com1);
  25. cin>>price>>c;
  26. for(j=0;j<c;j++){
  27. scanf(" ");
  28. getline(cin,item2);
  29. }
  30. if(c>max)
  31. {
  32. max=c;
  33. min=price;
  34. com2=com1;
  35.  
  36. }
  37. else if(c==max)
  38. {
  39. if(price<min)
  40. {
  41. min=price;
  42. com2=com1;
  43. }
  44. }
  45.  
  46. }
  47.  
  48. cout<<"RFP #"<<++t<<endl;
  49. cout<<com2<<endl;
  50. }
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement