Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool pierwsza(long long a)
  6. {
  7.     if(a<2) return false;
  8.  
  9.     for(long long i=2; i*i<=a; i++)
  10.         if(a%i==0)
  11.             return false;
  12.      return true;
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18.     long long  n;
  19.     cin>>n;
  20.     for(long long i=1; i<=n; i*=10){
  21.         long long c;
  22.         c=n/i;
  23.         long long  d;
  24.         d=n%i;
  25.         if(d<i/10) continue;
  26.         if(pierwsza(d)&&pierwsza(c)) {cout<<"TAK" ; return 0;}
  27.     }
  28.     cout<<"NIE";
  29.         return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement