-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsodep2.c
More file actions
38 lines (38 loc) · 701 Bytes
/
sodep2.c
File metadata and controls
38 lines (38 loc) · 701 Bytes
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
#include <stdio.h>
#include <math.h>
int thuannghich(long int n)
{
long int a[10], b, c = 0, sum = 0;
while (n > 0)
{
b = n % 10;
sum += b;
a[c] = b;
c++;
n /= 10;
}
if (sum % 10 != 0)
return 1;
for (int i = 0; i < c / 2; i++)
{
if (a[i] != a[c - 1 - i])
return 1;
}
return 0;
}
int main()
{
int k;
scanf("%d", &k);
while (k--)
{
long int n, a, b, num = 0;
scanf("%ld", &n);
a = pow(10, n - 1);
b = pow(10, n);
for (long int i = a; i < b; i++)
if (thuannghich(i) == 0)
num++;
printf("%ld\n", num);
}
}