Advertisement
Morass

Lightt No More Solution

Jan 16th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <cmath>
  3. #define F(W) for(int i(0);i<W;++i)
  4. #define FF(W) for(int j(0);j<W;++j)
  5. #define FT(I,W) for(int k(I);k<W;++k)
  6. typedef long long ll;
  7. ll a,f[128],H[128],L;
  8. #define MX (1<<17)
  9. ll P[MX],LL,cn[MX]={1,1};
  10. void gen(void){
  11.     for(int i(2);i<MX;++i)
  12.         if(!cn[i]){
  13.             P[LL++]=i;
  14.             for(int j(i<<1);j<MX;j+=i)
  15.                 cn[j]=1;
  16.         }
  17. }
  18. bool sl(ll n){
  19.     ll t(1);
  20.     for(ll i(L=0),ct(0);P[i]*P[i]<=n;++i,ct=0){
  21.         while(!(n%P[i]))
  22.             n/=P[i],++ct;
  23.         t*=ct+1;
  24.     }
  25.     if(n!=1)t*=2;
  26.     return t&1;
  27. }
  28. int main(void) {
  29.     gen();
  30.     while(scanf("%lld",&a),a)
  31.         printf("%s\n",sl(a)?"yes":"no");
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement