fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int a;
  5. string b;
  6.  
  7. int n;
  8. int ln;
  9. cin >> n;
  10. while(n--) {
  11. cin >> b;
  12. a=0;
  13. ln = b.length();
  14. for(int i = 0;i<ln;++i) {
  15. a*=2;
  16. a+=(int)b[i]-48;
  17. a%=10;
  18. }
  19. if(!a) {
  20. cout << "TAK" << endl;
  21. } else cout << "NIE" << endl;
  22. }
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 3416KB
stdin
3
101
111110100
10111
stdout
NIE
TAK
NIE