HUST Online Judge WebBoard
Problem 4043 >> 时间超限
201803010212 @ 2019-06-01 12:28:48
[ Quote ] [ Edit ] [ Delete ] 1#
#include<stdio.h>
int hws(int num)
{
int s,y=0;
s=num;
while(s>0)
{
y=y*10+s%10;
s=s/10;
}
if(y==num)
return 0;
else
return 1;
}
int prime(int x)
{
int s,y=0;
s=x;
while(s>0)
{
y=y*10+s%10;
s=s/10;
}
return y;
}
int main()
{
int n,m,i,j,k=0,t;
while(scanf("%d %d",&n,&m))
{
do
{
j=prime(n);
n=n+j;
k++;
}
while(hws(n));
if(m>=k)
printf("yes\n");
else
printf("no\n");
k=0;
}
return 0;
}