Advertisement
Guest User

Zadacha

a guest
Oct 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. # include <iostream>
  2. # include <string>
  3. # include <math.h>
  4. # include <cstdio>
  5.   using namespace std;
  6.   int prov(long long n);
  7.   int prov(long long n)
  8.   {
  9.       if((n/100000)+((n%100000)/10000)+((n%10000)/1000)==((n%1000)/100)+((n%100)/10)+(n%10)) return 1;
  10.       return 0;
  11.   }
  12.   int main()
  13.   {
  14.        freopen("INPUT.TXT","r",stdin);
  15.       freopen("OUTPUT.TXT","w",stdout);
  16.       long long i,k,a;
  17.       cin>>k;
  18.       for(i=1;i<=k;i++){
  19.           cin>>a;
  20.           if((prov(a-1)==1)||(prov(a+1)==1)) cout<<"Yes"<<'\n';
  21.           else                               cout<<"No"<<'\n';
  22.       }
  23.       return 0;
  24.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement