fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int n;
  8. cin>>n;
  9. vector<int> A(n);
  10. for(int i=0;i<n;i++) {
  11. cin>>A[i];
  12. }
  13. int mx=0;
  14. int sum=0;
  15. for(int i=0;i<n;i++) {
  16. mx=max(mx,A[i]);
  17. sum+=A[i];
  18. }
  19. sum=sum-mx;
  20. cout<<sum<<" "<<mx<<endl;
  21. if(sum>mx){
  22. cout<<"fair"<<endl;
  23. }
  24. else {
  25. cout<<"cheating"<<endl;
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5516KB
stdin
4
4 8 2 5
stdout
11 8
fair