它的意思是到后面越累越多吗,二的指数倍增长?但是最后判断不是只有v来和m对比吗,
代码如下:
#include <stdio.h>
int test_virus(unsigned int v, int T)
{
unsigned int M = 0x0003C000;
unsigned int v1, v2;
static int days = 0;
if ( ((v & M) ^ M )== 0)
return 1;
if (days >= 6)
return 0;
days++;
if ((1 << 31) & v != 0)
v1 = v << T;
else
v1 = v << 1;
if ((1 & v) != 0)
v2 = v >> T;
else
v2 = v >> 1;
if (test_virus(v1, T + 1))
return 1;
if (test_virus(v2, T + 1))
return 1;
return 0;
}
int main()
{
unsigned int a;
unsigned int T=0;
int n = 1;
scanf("%u", &a);
if (test_virus(a, T))
printf("yes");
else
printf("no");
return 0;
}