The time limit :1.0s Memory limit :512.0MB
123321 It's a very special number , It's the same thing to read from the left as it is to read from the right .
Enter a positive integer n, Programming for all such five and six decimal numbers , The sum of your numbers equals n
The input line , Contains a positive integer n.
Output the integers satisfying the conditions in the order of small to large , Each integer takes up one line .
52
899998
989989
998899
1<=n<=54.
n = int(input())
for i in range(10000, 100000):
x = i % 10 + (i//10)% 10 + (i // 100)% 10 + (i//1000)% 10 +( i//10000)% 10
#print(x)
if x == n:
if i % 10==( i // 10000)% 10 and(i//10)% 10 == (i // 1000)% 10:
print(i)
for i in range(100001, 1000000):
x = i % 10 + (i //10 )% 10+ (i // 100)% 10 + (i // 1000 )% 10+( i // 10000 )% 10+(i//100000)% 10
# print(x)
if x == n:
if i % 10==(i//100000)% 10 and (i // 10 )% 10 == ( i // 10000 )% 10 and(i // 100)% 10 == (i // 1000 )% 10:
print(i)
stay python3 in input Input is str If you want to compare the data in the type question, you should input the data z Convert to int type
i =123456
print(i/10)# Conventional division
print(i//10)# Only integer division is preserved
print(i%10)# Take the remainder
print(i/100)
print(i//100)
print(i%100)
Output
12345.6
12345
6
1234.56
1234
56