fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. unsigned t;
  9.  
  10. const int L10_6=6;
  11. const int L10_8=8;
  12. const int L10_343=343;
  13.  
  14. cin>>t;
  15.  
  16. while(t--){
  17. string L7;
  18. cin>>L7;
  19.  
  20. unsigned long long int L10=stoull(L7,nullptr,7);
  21. (L10%L10_6==0)?(cout<<"TAK"<<" "):(cout<<"NIE"<<" ");
  22. (L10%L10_8==0)?(cout<<"TAK"<<" "):(cout<<"NIE"<<" ");
  23. (L10%L10_343==0)?(cout<<"TAK"<<'\n'):(cout<<"NIE"<<'\n');
  24. }
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 15240KB
stdin
3
1234
121
14520000000
stdout
NIE NIE NIE
NIE TAK NIE
TAK TAK TAK