-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchuso4.c
56 lines (55 loc) · 971 Bytes
/
chuso4.c
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
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdio.h>
int rev(int n){
int dao = 0;
int m = n;
while (m > 0){
dao = dao * 10 + m % 10;
m /= 10;
}
if (dao == n)
return 1;
else
return 0;
}
int ckeck(int n){
while (n > 0){
int last = n % 10;
n /= 10;
if(last == 4)
return 0;
}
return 1;
}
int sum(int n){
int sum = 0;
while (n > 0)
{
int last = n % 10;
n /= 10;
sum += last;
}
if (sum % 10 == 0)
return 1;
else
return 0;
}
int main (){
int t;
scanf("%d", &t);
while (t --)
{
int n;
scanf("%d", &n);
int dau = 1, cuoi = 10;
while (n --){
dau *= 10;
cuoi *= 10;
}
for (int i = dau / 10; i < cuoi / 10; i ++){
if( rev(i) && sum(i) && ckeck(i)){
printf("%d ", i);
}
}
printf("\n");
}
}