Advertisement
Korotkodul

Ситуационная задача. Шаг в будущее

Oct 31st, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <string>
  5. #include <cmath>
  6. #include <set>
  7. #include <map>
  8. using namespace std;
  9. using ll = long long;
  10. int main()
  11. {
  12.     int n;
  13.     cin>>n;
  14.     int mx = -1;
  15.     int R1,R2,R3;
  16.     int ans;
  17.     for (int i = 1; i < n+1;++i){
  18.         cin>>R1>>R2>>R3;
  19.         if (i == 1){
  20.             mx = R1 + R2 + R3;
  21.             ans = i;
  22.         }
  23.         else{
  24.             int crnt = R1 + R2 + R3;
  25.             if (crnt > mx){
  26.                 mx = crnt;
  27.                 ans = i;
  28.             }
  29.         }
  30.     }
  31.     int rlns;
  32.     cin>>rlns;
  33.     cout<<ans<<'\n';
  34.     if (ans == rlns)cout<<"OK\n";
  35.     else cout<<"WA\n";
  36. }
  37.  
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement