Advertisement
adwas33

Untitled

Oct 23rd, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. using namespace std;
  5. int n=0;
  6. long long suma_1=0,suma_2=0;
  7. bool stop=1;
  8. int main()
  9. {
  10.     cin>>n;
  11.     vector<int>k(n);
  12.     for(int i=0;i<n;i++)
  13.     {
  14.         cin>>k[i];
  15.     }
  16.  
  17.     if(n%2==1)
  18.     {
  19.         cout<<"NIE";
  20.     stop=0;
  21.     }
  22.     if(stop){
  23.     sort(k.begin(),k.end());
  24.     for(int i=0;i<n;i++)
  25.     {
  26.         if(i%2==0)
  27.         {
  28.             suma_1+=k.at(i);
  29.  
  30.         }
  31.         else   suma_2+=k[i];
  32.     }
  33.     if(suma_1==suma_2)
  34.         cout<<"TAK";
  35.     else cout<<"NIE";
  36. }
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement