Facebook
From mefiu2910, 5 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 180
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5.         int c;
  6.         std::cin >> c;
  7.         while (c-- > 0)
  8.         {
  9.                 int a, b, d, e, f;
  10.                 std::cin >> a;
  11.                 if (a==1) { std::cout << "NIE" << std::endl; }
  12.                 else
  13.                 if (a==2||a==3||a==5||a==7) {
  14.                         std::cout << "TAK" << std::endl;
  15.  
  16.                 }
  17.                 else {
  18.  
  19.                         b = a % 2;
  20.                         e = a % 3;
  21.                         d = a % 5;
  22.                         f = a % 7;
  23.                         if (b == 0 || d == 0 || e == 0 || f == 0) {
  24.                                 std::cout << "NIE" << std::endl;
  25.  
  26.                         }
  27.                         else {
  28.                                 std::cout << "TAK" << std::endl;
  29.  
  30.                         }
  31.                 }
  32.  
  33.  
  34.         }
  35.         return 0;
  36. }