这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3346
心情有点烦躁,做不进去题,找了一道水题,先让自己平静下来。。。
#include
#include
#include
using namespace std;
int nCases, n, n1, n2;
int main()
{
cin >> nCases;
while(nCases--)
{
scanf("%d", &n;);
n1 = n2 = 0;
int tmp = n;
while(tmp)
{
n1 += tmp%10;
tmp /=10;
}
tmp = n;
while(tmp)
{
n2 += (tmp%10)*(tmp%10);
tmp /= 10;
}
if(n%8==0 || n1%8==0 || n2%8==0)
printf("Lucky number!\n");
else
printf("What a pity!\n");
}
}