Saleh127

Untitled

May 7th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6. ll a,c,d,i=1,aval;
  7. string ans,product,y;
  8. double x;
  9. while(1)
  10. {
  11. cin>>a>>c;
  12. if(a==0 && c==0) break;
  13. getchar();
  14. while(a--)
  15. {
  16. getline(cin,product);
  17. }
  18. ll need=-100;
  19. double value=0.0;
  20. while(c--)
  21. {
  22. getline(cin,product);
  23. cin>>x>>aval;
  24. getchar();
  25. if(aval>need)
  26. {
  27. need=aval;
  28. ans=product;
  29. value=x;
  30. }
  31. else if(aval==need && x<value)
  32. {
  33. need=aval;
  34. ans=product;
  35. value=x;
  36. }
  37. while(aval--)
  38. {
  39. getline(cin,y);
  40. }
  41. }
  42. if(i>1) printf("\n");
  43. printf("RFP #%lld\n",i++);
  44. cout<<ans<<endl;
  45. }
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment