#include<iostream>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
while(n--)
{
int m, sum = 0, temp = 0;
scanf("%d", &m);
if(m % 8 == 0)
{
printf("Lucky number!\n"); continue;
}
while(m)
{
sum += m % 10;
temp += (m % 10) * (m % 10);
m /= 10;
}
if(sum % 8 == 0|| temp % 8 == 0)
{
printf("Lucky number!\n"); continue;
}
else
printf("What a pity!\n");
}
return 0;
}
hdu 3346 Luck Number
最新推荐文章于 2018-09-11 21:45:58 发布