jakaria_hossain

lightoj - 1249 - Chocolate Thief

Aug 22nd, 2019
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. int main()
  5. {
  6. int te;
  7. cin>>te;
  8. for(int t=1;t<=te;t++)
  9. {
  10. string s,mxname,mnname;
  11. int n,a,b,c;
  12. cin>>n;
  13. int mn=10000000,mx=0;
  14. while(n--)
  15. {
  16. cin>>s;
  17. cin>>a>>b>>c;
  18. if(a*b*c>mx)
  19. {
  20. mx=a*b*c;
  21. mxname=s;
  22. }
  23. if(a*b*c<mn)
  24. {
  25. mn=a*b*c;
  26. mnname=s;
  27. }
  28. }
  29. if(mx==mn)printf("Case %d: no thief\n",t);
  30. else cout<<"Case "<<t<<": "<<mxname<<" took chocolate from "<<mnname<<endl;
  31. }
  32. }
RAW Paste Data