Toj 1493

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include<stdio.

h>
#include<stdlib.h>
int potencia(int a)
{
if(a==1) return 10;
return potencia(a-1)*10;
}
int main()
{
freopen("entrada.txt","r",stdin);
freopen("salida.txt","w",stdout);
int a[1000],d[2]={0},j,i=0,t;
char n[7];
while(scanf("%s",n)!=EOF){
t=strlen(n);
if(t==6){
d[1]=d[0]=0;
for(j=0;j<t;j++){
if(j<t/2) d[0]+=((atoi(&n[j])-atoi(&n[j+1]))/potencia(t-1-j
));
else if(j>=t/2 && j<t-1) d[1]+=((atoi(&n[j])-atoi(&n[j+1]))/p
otencia(t-1-j)) ;
else

d[1]+=atoi(&n[j]);

}
a[i]=abs(d[1]-d[0]);
i++;
}
else break;
}
t=0;
for(j=0;j<i;j++){
if(a[j]==1 ){
if((t%=2)==0) puts("Yes");
else puts("No");
t++;
}
else puts("No");
}
return 0;
}

You might also like