-
Notifications
You must be signed in to change notification settings - Fork 2
/
1123.txt
44 lines (34 loc) · 934 Bytes
/
1123.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
long long i,n,a[100001],cem,cem1,temp;
cin>>n;
for(i=1; i<=n; i++)
cin>>a[i];
for(i=1; i<=n; i++)
{
cem=0;
cem1=0;
if(a[i]%8==0)
cout<<"Lucky number!"<<endl;
else
{
temp=a[i];
while(temp!=0)
{
cem=cem+(temp%10);
cem1=cem1+(temp%10)*(temp%10);
temp=temp/10;
}
if(cem%8==0)
cout<<"Lucky number!"<<endl;
else if(cem1%8==0)
cout<<"Lucky number!"<<endl;
else
cout<<"What a pity!"<<endl;
}
}
return EXIT_SUCCESS;
}