Advertisement
Farjana_akter

Untitled

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