description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
def num(n):
s = str(n)
t = ""
for ch in s:
if ch == "0":
t += "0"
else:
t += "1"
return int(t)
n = int(cin())
ans = []
while n:
k = num(n)
n -= k
ans.append(k)
cout(str(len(ans)) + "\n")
for bin in ans:
cout(str(bin) + " ") | ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR STRING FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
p = list(str(n))
q = int(max(p))
n = str(n)
a = ["" for i in range(q)]
for i in range(len(n)):
c = int(n[i])
for i in range(q):
if c > 0:
a[i] += "1"
c -= 1
else:
a[i] += "0"
print(len(a))
for i in a:
print(bin(int(i, 2))[2:], end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR STRING VAR NUMBER VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def solved(s):
r = ""
for i in range(len(s)):
if s[i] != "0":
s[i] = str(int(s[i]) - 1)
r += "1"
else:
r += "0"
return r, s
n = list(input())
a = list()
while len(n):
r, n = solved(n)
a.append(r)
while len(n):
if n[0] == "0":
n.pop(0)
else:
break
print(len(a))
for i in a:
print(i, end=" ") | FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR STRING VAR STRING RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR VAR IF VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
s = str(n)
m = int(max(s))
print(m)
for i in range(m):
ed = False
for j in range(len(s)):
if int(s[j]) > i:
ed = True
print(1, end="")
elif ed:
print(0, end="")
print(" ", end="") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING IF VAR EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL VAR STRING STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | a = input()
b = max(map(int, a))
c = [0] * 9
for i in a:
for j in range(9):
c[j] *= 10
for j in range(int(i)):
c[j] += 1
print(b)
print(" ".join(map(str, [i for i in c if i]))) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def kvbin(sd):
for i in range(len(sd)):
if sd[i] != "1" and sd[i] != "0":
sd = sd[:i] + "1" + sd[i + 1 :]
return sd
n = int(input())
s = str(n)
for i in range(len(s)):
if s[i] != "1" and s[i] != "0":
s = s[:i] + "1" + s[i + 1 :]
ans = []
while n != 0:
s = kvbin(str(n))
sint = int(s)
s = str(sint)
ans.append(s)
n -= sint
print(len(ans))
for i in ans:
print(i, end=" ") | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR STRING VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR STRING VAR BIN_OP VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = str(input())
v = list()
for i in range(1, 10):
can = str()
for j in n:
if int(j) >= i:
can += "1"
elif len(can) > 0:
can += "0"
if len(can) > 0:
v.append(can)
print(len(v))
print(" ".join(v)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF FUNC_CALL VAR VAR VAR VAR STRING IF FUNC_CALL VAR VAR NUMBER VAR STRING IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | q = input()
count = 0
arr1 = []
q = int(q)
t = ""
while q > 0:
for i in str(q):
if i > "0":
t += "1"
else:
t += "0"
x = int(t)
count += 1
arr1.append(x)
q = q - x
t = ""
print(count)
print(*arr1) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING WHILE VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
z = float("-inf")
l = [(0) for i in range(len(n))]
for i in range(len(n)):
l[i] = int(n[i])
k = max(l)
r = [[(0) for i in range(len(n))] for j in range(k)]
for i in range(len(n)):
for j in range(int(n[i])):
r[j][i] = r[j][i] + 1
str_ = ""
for i in range(len(r)):
s = ""
flag = 0
for j in range(len(r[i])):
if r[i][j] == 0 and flag == 0:
continue
if r[i][j] == 1:
flag = 1
s = s + str(r[i][j])
str_ = str_ + s + " "
print(k)
print(str_) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | number = str(input())
strContat = ""
count = 0
numbers = []
while int(number) != 0:
for i in number:
if int(i) > 0:
strContat = strContat + "1"
else:
strContat = strContat + "0"
number = str(int(number) - int(strContat))
count += 1
numbers.append(strContat)
strContat = ""
print(count)
print(" ".join(numbers)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | units = list(map(int, input()))[::-1]
X = [(0) for i in range(9)]
for digit in range(len(units)):
i = units[digit]
for k in range(i):
X[k] += 10**digit
ans = ""
L = 0
for t in X:
if t != 0:
L += 1
ans += str(t) + " "
ans = ans[:-1]
print(L)
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP NUMBER VAR ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR STRING ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | k = [int(i) for i in input()]
print(max(k))
nums = []
while max(k) > 0:
d = ["0"] * len(k)
for x in range(len(k)):
if k[x] > 0:
k[x] -= 1
d[x] = "1"
n = "".join(d)
while n[0] == "0":
n = n[1:]
nums.append(n)
print(" ".join(nums)) | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR STRING ASSIGN VAR FUNC_CALL STRING VAR WHILE VAR NUMBER STRING ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | __author__ = "runekri3"
inp = input()
outs = [0] * 9
digits = [int(digit) for digit in list(inp)]
for power in range(7):
if not digits:
break
power_of_10 = 10**power
digit = digits.pop()
for index in range(digit):
outs[index] += power_of_10
result = [str(number) for number in outs if number != 0]
print(len(result))
print(" ".join(result)) | ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = str(int(input()))
l = []
while 1:
s1 = ""
k = 0
for i in range(len(n)):
if int(n[i]) > 1:
s1 += "1"
k = 1
else:
s1 += n[i]
l.append(int(s1))
if k == 0:
break
n = str(int(n) - int(s1))
print(len(l))
print(*l) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER VAR STRING ASSIGN VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def quasibA(numberArray, resultArray):
summand = []
nichtN = False
i = 0
while i < len(numberArray):
x = numberArray[i]
if x > 0:
summand.append(1)
numberArray[i] = x - 1
nichtN = True
else:
summand.append(0)
i += 1
summandAsInt = int("".join(map(str, summand)))
if nichtN:
resultArray.append(summandAsInt)
quasibA(numberArray, resultArray)
else:
print(str(len(resultArray)))
print(" ".join(list(map(str, resultArray))))
number = input()
numberArray = [int(x) for x in number]
quasibA(numberArray, []) | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR IF VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR LIST |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = list(map(int, list(input())))
print(max(n))
for _ in range(max(n)):
x = ""
for l in range(len(n)):
if n[l] > 0:
x += "1"
n[l] -= 1
else:
x += "0"
print(int(x), end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
tn = n
arr = [0] * 10
i = 1
while tn:
val = tn % 10
tn //= 10
for j in range(val):
arr[j] += i
i *= 10
j = 9
while arr[j] == 0:
j -= 1
print(j + 1)
for _ in range(j + 1):
print(arr[_]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
ans = []
while n > 0:
temp = n
p = 1
m = 0
while temp > 0:
if temp % 10 > 0:
m += p
p *= 10
temp //= 10
if m > 0:
ans.append(m)
n -= m
print(len(ans))
for x in ans:
print(x, end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | from sys import stdin, stdout
s = input()
n = len(s)
temp = [int(i) for i in s]
ans = ["" for i in range(9)]
for i in temp:
for j in range(9):
ans[j] += "01"[i > j]
ans = [i for i in map(int, ans) if i]
print(len(ans))
print(*ans)
quit()
read = lambda: map(int, stdin.readline().split())
I = lambda: stdin.readline()
n = int(I())
arr = tuple(read())
memo = {}
poss = [[0], [0, 1], [0, 2], [0, 1, 2]]
dp = [[(10**6) for i in range(3)] for i in range(n + 1)]
dp[n] = [0, 0, 0]
for i in range(n - 1, -1, -1):
for last in range(3):
for p in poss[arr[i]]:
dp[i][last] = min(
dp[i][last], (1 if last & p or p == 0 else 0) + dp[i + 1][p]
)
print(dp[0][0]) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR STRING VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST LIST NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR LIST NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR NUMBER NUMBER NUMBER VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR NUMBER NUMBER |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = [
1,
10,
11,
100,
101,
110,
111,
1000,
1001,
1010,
1011,
1100,
1101,
1110,
1111,
10000,
10001,
10010,
10011,
10100,
10101,
10110,
10111,
11000,
11001,
11010,
11011,
11100,
11101,
11110,
11111,
100000,
100001,
100010,
100011,
100100,
100101,
100110,
100111,
101000,
101001,
101010,
101011,
101100,
101101,
101110,
101111,
110000,
110001,
110010,
110011,
110100,
110101,
110110,
110111,
111000,
111001,
111010,
111011,
111100,
111101,
111110,
111111,
]
n = int(input())
ls = []
total = 0
while n > 1:
tmp = ""
count = 0
n = str(n)
for i in range(len(n)):
if n[i] == "0":
tmp += "0"
count += 1
else:
tmp += "1"
if n[i] == "1":
count += 1
temp = int(tmp)
ls.append(temp)
n = int(n)
n -= temp
total += 1
if n == 1:
ls.append(1)
total += 1
print(total)
for num in ls:
print(num, end=" ") | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING VAR NUMBER VAR STRING IF VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
d = {}
x = 0
maximum = -1
list1 = []
while n > 0:
d[str(10**x)] = n % 10
if maximum < n % 10:
maximum = n % 10
n = n // 10
x += 1
print(maximum)
for z in range(maximum):
sum1 = 0
for y in d:
if int(d[y]) > 0:
sum1 += int(y)
d[y] -= 1
print(sum1, end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def doChislo(n):
s = str(n)
answ = 0
for i in range(len(s)):
if s[i] != "0":
answ += 10 ** (len(s) - i - 1)
return answ
def main():
n = int(input())
answ = []
while n:
m = doChislo(n)
n -= m
answ.append(m)
print(len(answ))
print(*answ)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | from sys import stdin
stdin.readline
def mp():
return list(map(int, stdin.readline().strip().split()))
def it():
return int(stdin.readline().strip())
n = it()
v = []
while n > 0:
temp = n
m = 0
p = 1
while temp:
rem = temp % 10
temp //= 10
if rem != 0:
m += p
p *= 10
v.append(m)
n -= m
print(len(v))
print(*v) | EXPR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
steps = 0
s = ""
while True:
if n == 0:
break
elif n == 1:
s += str(n)
steps += 1
break
else:
n_str = str(n)
n_str_upd = ""
for i in range(len(n_str)):
if ord(n_str[i]) > ord("0"):
n_str_upd += str(int(n_str[i]) - 1)
else:
n_str_upd += str(int(n_str[i]))
steps += 1
n_upd = int(n_str_upd)
s += str(n - n_upd) + " "
n = n_upd
print(steps)
print(s) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING WHILE NUMBER IF VAR NUMBER IF VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR STRING ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | mod = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: map(int, input().split())
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
s = si()
n = len(s)
mx = max(int(i) for i in s)
l = [[(0) for i in range(n)] for j in range(mx)]
for i in range(n):
x = int(s[i])
for j in range(x):
l[j][i] = 1
print(len(l))
for i in l:
x = i.index(1)
print("".join(str(i[k]) for k in range(x, n)), end=" ") | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
a = [int(c) for c in n]
m = max(a)
print(m)
for i in range(m):
s = ""
for j, c in enumerate(a):
if s or c:
s += "1" if c > 0 else "0"
if c:
a[j] -= 1
print(s, end=" ") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER STRING STRING IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | R = lambda: map(int, input().split())
x = int(input())
xs = list(map(int, str(x)))
res = []
while max(xs):
k = min(filter(lambda i: i > 0, xs))
raw = [(1 if i >= k else 0) for i in xs]
num = 0
for xx in raw:
num = 10 * num + xx
res += [num] * k
xs = [(a - b) for a, b in zip(xs, [(i * k) for i in raw])]
print(len(res))
print(" ".join(map(str, res))) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR VAR VAR NUMBER NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR VAR BIN_OP LIST VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | from sys import stdin, stdout
def INI():
return int(stdin.readline())
def INL():
return [int(_) for _ in stdin.readline().split()]
def INS():
return stdin.readline()
def MOD():
return pow(10, 9) + 7
def OPS(ans):
stdout.write(str(ans) + "\n")
def OPL(ans):
[stdout.write(str(_) + " ") for _ in ans]
stdout.write("\n")
n = str(INI())
ans = int(max(n))
ANS = [None] * ans
for _ in range(len(n)):
for __ in range(ans):
if _ == 0:
if __ < int(n[_]):
ANS[__] = "1"
else:
ANS[__] = "0"
elif __ < int(n[_]):
ANS[__] += "1"
else:
ANS[__] += "0"
ANS = [int(_) for _ in ANS]
OPS(ans)
OPL(ANS) | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR STRING ASSIGN VAR VAR STRING IF VAR FUNC_CALL VAR VAR VAR VAR VAR STRING VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
f = []
while n != 0:
k = ""
for i in str(n):
if i != "0":
k += "1"
else:
k += "0"
k = int(k)
n -= k
f.append(k)
print(len(f))
for i in range(len(f)):
print(f[i], end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n, out = input(), []
digits = list(map(int, n))
while sum(digits) > 0:
o = [(1 if d > 0 else 0) for d in digits]
digits = [(x - y) for x, y in zip(digits, o)]
out.append(int("".join(map(str, o))))
print(len(out))
print(" ".join(map(str, out))) | ASSIGN VAR VAR FUNC_CALL VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | x = str(int(input()))
li, li2, y = [], [], int(max(x))
for i in x:
li.append(int(i))
for i in range(y):
str1 = ""
for j in range(len(x)):
if li[j] > 0:
str1 += str(1)
li[j] -= 1
else:
str1 += str(0)
li2.append(int(str1))
print(y)
print(*li2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | a = list(map(int, list(input())))
x = []
g = max(a)
for _ in range(g):
c = ""
for i in range(len(a)):
if a[i] > 0:
a[i] -= 1
c = c + "1"
elif c:
c = c + "0"
x += [c]
print(g)
print(*sorted(x)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING IF VAR ASSIGN VAR BIN_OP VAR STRING VAR LIST VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = list(map(int, input()))
le = len(n)
l = [(["0"] * le) for i in range(max(n))]
for j in range(le):
for i in range(n[j]):
l[i][j] = "1"
print(max(n))
l = list(map("".join, l))
l = list(map(int, l))
print(" ".join(map(str, l))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
l = len(n)
m = int(max(n))
matrix = []
for i in range(m):
matrix.append([0] * l)
for j in range(l):
for k in range(int(n[j])):
matrix[k][j] = 1
for i in range(m):
while matrix[i][0] == 0:
matrix[i].pop(0)
matrix[i] = "".join(map(str, matrix[i]))
print(len(matrix))
print(" ".join(map(str, matrix))) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | strN = input()
l = len(strN)
strN = list(map(int, list(strN)))
k = max(strN)
print(k)
res = [(0) for i in range(k)]
for i in range(l):
for j in range(strN[i]):
res[j] += 10 ** (l - i - 1)
print(*res, sep=" ") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP NUMBER BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
ans = int(max(list(n)))
print(ans)
for i in range(ans):
num = ""
for pos in range(len(n)):
if int(n[pos]) >= i + 1:
num += "1"
else:
num += "0"
print(int(num), end=" ") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
ans = []
while n:
temp = n
res = 0
x = 1
while temp:
rem = temp % 10
if rem != 0:
res += x
x = x * 10
temp //= 10
n -= res
ans.append(res)
print(len(ans))
for i in ans:
print(i, end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
if n == 0:
print(1)
print(0)
else:
a = []
t = 0
for i in n:
t = max(t, int(i))
a = [int(i)] + a
print(t)
while a != [0] * len(n):
ch = 9999999
pn = 0
for i in range(len(a)):
if a[i] > 0:
a[i] -= 1
pn += 10**i
print(pn, end=" ") | ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR WHILE VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
c = str(n)
L = [int(c[i]) for i in range(len(c))]
R = ""
r = 0
while max(L) > 0:
r += 1
s = ""
for i in range(len(c)):
if L[i] > 0:
L[i] -= 1
s = s + "1"
else:
s = s + "0"
R = R + s[s.index("1") :] + " "
print(r)
print(R) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
le = len(n)
l = [
sum(10 ** (le - 1 - i) if int(y) >= x else 0 for i, y in enumerate(n))
for x in range(1, 10)
]
l = sorted([str(x) for x in l if x > 0])
print(len(l))
print(" ".join(l)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = list(input())
t = int(max(n))
ans = []
for i in range(t):
ans.append(["0"] * len(n))
for i in range(len(n)):
c = int(n[i])
for j in range(c):
ans[j][i] = "1"
ans2 = []
for i in ans:
ans2.append(int("".join(i)))
print(t)
ans2.sort()
print(*ans2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR STRING ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | import sys
input = sys.stdin.readline
inp, ip = lambda: int(input()), lambda: [int(w) for w in input().split()]
s = input().strip()
mx = max(map(int, s))
print(mx)
n = len(s)
x = [(["0"] * n) for i in range(mx)]
for i in range(n):
for j in range(int(s[i])):
x[j][i] = "1"
x = [int("".join(i)) for i in x]
print(*x) | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
def f(k):
b, c = 0, 10
for _i in range(7):
i = 10**_i
if int(k / i) % 10:
b += i
c = min(c, int(k / i) % 10)
return b, c
l = []
while n > 0:
l.append(f(n))
n -= l[-1][0] * l[-1][1]
print(sum(map(lambda x: x[1], l)))
print(" ".join(map(lambda x: " ".join([str(x[0])] * x[1]), l))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER RETURN VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL STRING BIN_OP LIST FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def main():
n = [int(i) for i in input()]
number = max(n)
print(number)
for i in range(number):
k = []
for j in n:
if j > i:
k.append(1)
elif k:
k.append(0)
print("".join(str(i) for i in k), end=" ")
print()
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | a = list(map(int, list(input())))
m = max(a)
b = [0] * m
for i in a:
for j in range(m):
b[j] = b[j] * 10 + (1 if j < i else 0)
print(m)
print(*b) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = str(input())
mx = 0
for i in range(len(s)):
mx = max(mx, ord(s[i]) - ord("0"))
print(mx)
dp = [["0" for i in range(len(s))] for y in range(mx)]
for i in range(len(s)):
for j in range(ord(s[i]) - ord("0")):
dp[j][i] = "1"
for i in range(mx):
st = "".join(dp[i])
print(st.lstrip("0"), end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR STRING STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
a = [int(x) for x in n]
ans = []
mx = max(a)
for i in range(mx):
l = [(0) for x in range(len(a))]
ans += [l]
for j in range(len(a)):
val = a[j]
for i in range(mx):
if val > 0:
ans[i][j] = 1
val -= 1
else:
ans[i][j] = 0
res = []
for i in range(mx):
v = ""
j = 0
while j < len(a) and ans[i][j] == 0:
j += 1
while j < len(a):
v += str(ans[i][j])
j += 1
res += [int("".join(v))]
print(mx)
print(*res) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR LIST VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER VAR LIST FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
arr = []
k = 0
while n > 0:
m = ""
for i in str(n):
if i > "0":
m += "1"
else:
m += "0"
n = n - int(m)
k += 1
arr.append(int(m))
print(k)
print(*arr) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRING ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = input()
r = []
while set(s) != set("0"):
r += [str(int("".join(["0", "1"][i != "0"] for i in s)))]
s = list(map(lambda x: str(max(0, int(x) - 1)), s))
print(len(r))
print(" ".join(r)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR FUNC_CALL VAR STRING VAR LIST FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING LIST STRING STRING VAR STRING VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
ans1 = max([int(x) for x in n])
ans2 = ["" for _ in range(ans1)]
for i in n:
cnt = int(i)
for j in range(ans1):
if cnt > 0:
ans2[j] += "1"
cnt -= 1
else:
ans2[j] += "0"
print(ans1)
print(" ".join([str(int(x)) for x in ans2])) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR STRING VAR NUMBER VAR VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = list(map(int, input()))
result = []
while any(n):
cn = ""
for i in range(len(n)):
cn += "1" if n[i] else "0"
n[i] = max(0, n[i] - 1)
result.append(str.lstrip(cn, "0"))
print(len(result))
print(str.join(" ", result)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR STRING STRING ASSIGN VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def answer(n):
ans = []
nl = list(str(n))
nln = []
for e in nl:
nln.append(int(e))
while max(nln) > 0:
t = []
for i in range(len(nln)):
if nln[i] >= 1:
t.append("1")
nln[i] -= 1
else:
t.append("0")
ans.append("".join(t))
ansn = []
for e in ans:
ansn.append(int(e))
print(len(ansn))
print(" ".join(map(str, ansn)))
return
def main():
n = int(input())
answer(n)
return
main() | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR STRING VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR RETURN FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR RETURN EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | __author__ = "artyom"
i, a, n = 1000000, [], int(input())
while i > 0:
a.append(n // i)
n %= i
i //= 10
p, l = [], len(a)
while 1:
y, z = "", 1
for i in range(l):
if a[i] > 0:
a[i] -= 1
y += "1"
z = 0
elif not z:
y += "0"
if z:
break
else:
p.append(y)
print(len(p))
print(" ".join(p)) | ASSIGN VAR STRING ASSIGN VAR VAR VAR NUMBER LIST FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR LIST FUNC_CALL VAR VAR WHILE NUMBER ASSIGN VAR VAR STRING NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING IF VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
s = str(n)
ans = []
while n > 0:
s = list(s)
for i in range(len(s)):
if s[i] != "0":
s[i] = "1"
s = "".join(s)
ans.append(s)
n -= int(s)
s = str(n)
print(len(ans))
print(*ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR STRING ASSIGN VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input().rstrip()
ans = []
while n != "0":
sub = ""
for i in n:
if int(i) >= 1:
sub += "1"
else:
sub += "0"
ans.append(sub)
n = str(int(n) - int(sub))
print(len(ans))
print(*ans) | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR STRING ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def get_data(data):
return data[0]
def get_answer(value):
res = 0
l = [(int(value[i]), i) for i in range(len(value))]
l.sort(key=get_data)
inc = 0
iszero = {-1}
answer = []
for data in l:
res = ""
for j in range(len(value)):
if j not in iszero:
res += str(1)
else:
res += str(0)
res = int(res)
for i in range(data[0] - inc):
answer.append(res)
inc += data[0] - inc
iszero.add(data[1])
print(inc)
for i in answer:
print(i, end=" ")
value = input()
get_answer(value) | FUNC_DEF RETURN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = input()
mat = []
for i in s:
mat.append(int(i))
sat = [0] * max(mat)
for i in range(len(mat)):
for j in range(mat[i]):
sat[j] += 10 ** (len(mat) - i - 1)
print(len(sat))
print(*sat) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | d = list(map(int, list(input())))
r = []
n = len(d)
for i in range(n):
while d[i] > 0:
w = ""
for j in range(i, n):
if d[j] > 0:
d[j] -= 1
w += "1"
else:
w += "0"
r.append(w)
print(len(r))
print(" ".join(r)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
ans = 0
number = []
for i in n:
ans = max(ans, int(i))
number.append(int(i))
print(ans)
curr = ans
soln = []
while curr:
temp = ""
for i in range(len(number)):
if number[i] == curr:
number[i] -= 1
temp += "1"
else:
temp += "0"
soln.append(temp)
curr -= 1
for i in soln:
one = False
for j in i:
if j == "1" or one:
print(j, end="")
if j == "1":
one = True
print(" ", end="") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR EXPR FUNC_CALL VAR VAR STRING IF VAR STRING ASSIGN VAR NUMBER EXPR FUNC_CALL VAR STRING STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def solve():
n = int(input())
if n == 0:
print(1)
print(0)
return
a = [0] * 10
k = n
max = 0
for i in range(0, 10):
if k > 0:
a[i] = k % 10
if a[i] > max:
max = a[i]
k = int(k / 10)
print(max)
sum = 0
for j in range(0, max):
r = 0
k = 1
for i in range(0, 10):
if a[i] > 0:
a[i] = a[i] - 1
r = r + k
k = k * 10
print(r, end=" ")
sum = sum + r
solve() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = input()
k = 0
for i in range(len(s)):
k = max(k, ord(s[i]) - ord("0"))
arr = []
for i in range(k):
arr.append("")
for i in range(len(s)):
for j in range(k):
if ord(s[i]) - ord("0") > j:
arr[j] += "1"
elif len(arr[j]) != 0:
arr[j] += "0"
print(k)
for i in range(k):
if i != 0:
print(" ", end="")
print(arr[i], end="") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING VAR VAR VAR STRING IF FUNC_CALL VAR VAR VAR NUMBER VAR VAR STRING EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
k = str(1 * 10 ** (len(n) - 1))
li = [list(k) for i in range(int(n[0]))]
for i in range(1, len(n)):
for j in range(int(n[i])):
if j >= len(li):
for _ in range(j - len(li) + 1):
li.append(["0"] * len(n))
li[j][i] = "1"
ans = []
for i in li:
k = "".join(i)
k = int(k)
ans.append(k)
print(len(ans))
print(*ans) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR VAR VAR STRING ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
prev = []
while n:
x = "".join(str(int(i != "0")) for i in str(n))
prev.append(x)
n -= int(x)
print(len(prev))
print(*prev) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def getVal(n):
r = 0
bas = 1
while n > 0:
if n % 10 > 0:
r += bas
bas *= 10
n = int(n / 10)
return r
res = []
n = int(input())
while n > 0:
t = getVal(n)
n -= t
res.append(t)
print(len(res))
for x in res:
print(x, "", end="") | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = list(map(int, input()))
print(max(n))
for _ in range(max(n)):
res = []
for i in range(len(n)):
if n[i] > 0:
n[i] -= 1
res += ["1"]
elif len(res) > 0:
res += ["0"]
print("".join(res)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR LIST STRING IF FUNC_CALL VAR VAR NUMBER VAR LIST STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def solve(s):
a = list(map(int, s))
out = str(max(a)) + "\n"
for i in range(max(a)):
ts = ""
for x in a:
if x > i:
ts += "1"
else:
ts += "0"
out += ts.lstrip("0") + " "
return out
s = input()
print(solve(s)) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR VAR VAR STRING VAR STRING VAR BIN_OP FUNC_CALL VAR STRING STRING RETURN VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | from sys import stdin, stdout
def main():
from sys import stdin, stdout
n = int(stdin.readline())
ans = []
while n:
t = ""
num = str(n)
for i in num:
if int(i):
t += "1"
else:
t += "0"
ans.append(t)
n -= int(t)
stdout.write(str(len(ans)) + "\n")
for i in ans:
stdout.write(i + " ")
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR IF FUNC_CALL VAR VAR VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR STRING FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR STRING EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = int(input().strip())
nos = []
while s != 0:
val = str()
for x in range(len(str(s))):
if str(s)[x] != "0":
val = val + "1"
else:
val = val + "0"
s -= int(val)
nos += [int(val)]
print(len(nos))
for x in range(len(nos)):
print(nos[x], end=" ")
print() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING VAR FUNC_CALL VAR VAR VAR LIST FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | x = input()
s = int(max(x))
print(s)
ls = list(map(int, x))
v = []
def f(s):
res = 0
s.reverse()
for n in range(len(s)):
res += s[n] * 10**n
return res
res = []
for n in range(s):
j = []
for n in range(len(ls)):
if ls[n] > 0:
j.append(1)
ls[n] -= 1
else:
j.append(0)
v.append(j)
res = list(map(f, v))
print(*res) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FUNC_DEF ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR BIN_OP NUMBER VAR RETURN VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | a = list(map(int, input()))
res = []
tt = [0] * len(a)
while a != tt:
t = ["0"] * len(a)
for i, x in enumerate(a):
if x > 0:
t[i] = "1"
a[i] -= 1
res.append("".join(t).lstrip("0"))
print(len(res))
print(" ".join(res)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR STRING VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
sn = str(n)
l = len(sn)
def getDecimal(n):
return len(str(n)) - 1
def intAr(a):
b = []
for i in a:
b.append(int(i))
return b
def getQDNumber(number):
inum = int(number)
_n = intAr(number)
n = ""
pointer = 0
_len = len(number)
if inum:
if inum >= 10:
while 1:
if _n[pointer] is 0:
n += "0"
else:
_n[pointer] -= 1
n += "1"
pointer += 1
if pointer >= _len:
break
else:
n = "1"
if inum - int(n) >= 0:
return n + " " + str(getQDNumber(str(inum - int(n))))
return ""
n = getQDNumber(sn)
print(len(n.split(" ")) - 1)
print(n) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR IF VAR NUMBER WHILE NUMBER IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING VAR NUMBER IF VAR VAR ASSIGN VAR STRING IF BIN_OP VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP BIN_OP VAR STRING FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR VAR RETURN STRING ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | x = []
for i in input():
x += [int(i)]
l = []
while len(x):
d = 0
for i in range(len(x)):
if x[i] > 0:
d += int(10 ** (len(x) - i - 1))
x[i] -= 1
l += [d]
while len(x) and x[0] == 0:
x.pop(0)
print(len(l))
print(*l) | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR LIST FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR VAR NUMBER VAR LIST VAR WHILE FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
b = [
1,
10,
11,
100,
101,
110,
111,
1000,
1001,
1010,
1011,
1100,
1101,
1110,
1111,
10000,
10001,
10010,
10011,
10100,
10101,
10110,
10111,
11000,
11001,
11010,
11011,
11100,
11101,
11110,
11111,
100000,
100001,
100010,
1000011,
100100,
100101,
100110,
100111,
101000,
101001,
101010,
101011,
101100,
101101,
101110,
101111,
110000,
110001,
110010,
110011,
110100,
110101,
110110,
110111,
111000,
111001,
111010,
111011,
111100,
111101,
111110,
111111,
]
b = b[::-1]
def FindNumber(n):
m = 0
while n != 0:
if n % 10 > m:
m = n % 10
n = int(n / 10)
return m
number = FindNumber(n)
print(number)
def FindNum(n, number):
global b
if number != FindNumber(n):
return -1
if number == 1:
print(n, end=" ")
return 1
for i in b:
if i > n:
continue
else:
num = FindNum(n - i, number - 1)
if num == -1:
continue
else:
print(i, end=" ")
break
FindNum(n, number) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF IF VAR FUNC_CALL VAR VAR RETURN NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING RETURN NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
d = list()
for c in n:
d.append(int(c))
count = 0
nums = list()
while max(d) != 0:
i = 0
while d[i] == 0:
i += 1
cur_num = ""
for j in range(i, len(d)):
if d[j] != 0:
d[j] -= 1
cur_num = cur_num + "1"
else:
cur_num = cur_num + "0"
nums.append(cur_num)
print(len(nums))
for cur_num in nums:
print(cur_num, end=" ") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def Count(n):
if n == 0:
return 0
c = Count(n // 10)
return n % 10 if n % 10 > c else c
def QNum(n):
if n <= 0:
return
nn = n
newN = 0
string = ""
p = 0
out = 0
while nn > 0:
d = nn % 10
nd = d - 1 if d > 0 else 0
ndd = 1 if d > 0 else 0
nn = nn // 10
newN += nd * 10**p
out += ndd * 10**p
p += 1
print(out)
QNum(newN)
n = int(input())
print(Count(n))
QNum(n) | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER RETURN BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR FUNC_DEF IF VAR NUMBER RETURN ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR BIN_OP NUMBER VAR VAR BIN_OP VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
a = [0] * 10
k = 1
while n > 0:
m = n % 10
for i in range(m):
a[i] += k
k *= 10
n = int(n / 10)
i = 0
k = 0
while a[i] != 0:
i += 1
k += 1
print(k)
for x in a:
if x != 0:
print(x, end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = input().strip()
arr = []
while s:
s = str(s)
x = "".join([("1" if i != "0" else "0") for i in s])
s = int(s)
s -= int(x)
arr.append(x)
print(len(arr))
print(*arr) | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING VAR STRING STRING STRING VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = list(map(int, input()))
ans = []
k = len(n)
while sum(n) != 0:
now = ""
for i in range(k):
if n[i] != 0:
now += "1"
n[i] -= 1
else:
now += "0"
ans.append(int(now))
print(len(ans))
print(*ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | import sys
def solve(num):
nums = list(map(int, [c for c in str(num)]))
rv = []
for v in list(range(9, 0, -1)):
curval = 0
for idx, n in enumerate(nums):
if n >= v:
curval += 10 ** (len(nums) - 1 - idx)
if curval > 0:
rv.append(str(curval))
return max(nums), " ".join(rv)
data = sys.stdin.read().strip()
count, ans = solve(data)
print(count)
print(ans) | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR RETURN FUNC_CALL VAR VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | import sys
input = sys.stdin.readline
def is_quasi(num):
return all(c == "1" or c == "0" for c in str(num))
num = int(input())
res = []
while not is_quasi(num):
snum = str(num)
new_num = []
for c in snum:
if c == "0":
new_num.append("0")
else:
new_num.append("1")
new_num = int("".join(new_num))
res.append(new_num)
num -= new_num
if num != 0:
res.append(num)
print(len(res))
print(*res) | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR STRING VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
arr = [1]
for x in arr:
z = x * 10
if z <= n:
arr.append(z)
z += 1
if z <= n:
arr.append(z)
dp = [10**9] * (n + 1)
last = [-1] * (n + 1)
dp[0] = 0
for i in range(n):
for x in arr:
if i + x <= n:
if dp[i + x] > dp[i] + 1:
dp[i + x] = dp[i] + 1
last[i + x] = x
x = n
ans = []
while x > 0:
ans.append(str(last[x]))
x -= last[x]
print(len(ans))
print(" ".join(ans[::-1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST BIN_OP NUMBER NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR VAR IF BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
nums = [int(i) for i in str(n)]
output = []
for index, i in enumerate(nums):
j = 0
while j < i:
try:
output[j] += 1
except:
output.append(1)
j += 1
if index != len(nums) - 1:
output = list(map(lambda x: x * 10, output))
print(len(output))
for i in output:
print(i, end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
m = 0
for i in n:
if int(i) > m:
m = int(i)
l = len(n)
t = [(["0"] * l) for i in range(m)]
for i in range(l):
for j in range(int(n[i])):
t[j][i] = "1"
print(m)
for i in range(m - 1):
s = ""
for j in t[i]:
s += j
print(int(s), end=" ")
s = ""
for j in t[m - 1]:
s += j
print(int(s)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR STRING ASSIGN VAR STRING FOR VAR VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | store = []
def func(s):
l = len(str(s))
f = ["0"] * l
f[0] = "1"
for i in range(1, l):
f[i] = "1"
if int(str(s)[i]) < int(f[i]):
f[i] = "0"
store.append("".join(f))
s -= int("".join(f))
return s
n = int(input())
while n:
n = func(n)
store.reverse()
print(len(store))
for i in store:
print(i, end=" ") | ASSIGN VAR LIST FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR STRING IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR VAR FUNC_CALL VAR FUNC_CALL STRING VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | a = input()
list = []
m = ""
s = int(a)
while s > 0:
for i in range(len(a)):
if int(a[i]) > 0:
m += "1"
else:
m += "0"
list.append(m)
s = s - int(m)
a = str(s)
m = ""
print(len(list))
for i in range(len(list)):
print(list[i], end=" ") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
a = []
while n > 0:
d = int("".join(min(x, "1") for x in str(n)))
n -= d
a += [d]
print(len(a))
print(" ".join(map(str, a))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR VAR VAR VAR VAR LIST VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | from sys import stdin
n = int(stdin.readline().rstrip())
a = str(n)
l = []
while n > 0:
x = 1
for i in a[1:]:
if int(i) > 0:
x = x * 10 + 1
else:
x = x * 10
l.append(x)
n = n - x
a = str(n)
print(len(l))
print(*l) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def fun(n):
n = str(n)
l = []
for i in n:
if i == "0":
l.append("0")
else:
l.append("1")
return int("".join(l))
n = int(input())
l = []
while not n == 0:
x = fun(n)
n -= x
l.append(x)
sorted(l)
print(len(l))
for i in l:
print(i, end=" ") | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING RETURN FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
if n.count("0") + n.count("1") == len(n):
print(1)
print(n)
else:
summands = []
x = int(max(n))
for i in range(x):
summand = ""
for j in n:
if int(j) > 0:
summand += "1"
else:
summand += "0"
summands.append(int(summand))
n = str(int(n) - int(summand))
print(len(summands))
for elem in summands:
print(elem, end=" ") | ASSIGN VAR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def res(arr):
s = ""
for item in arr:
s += item
return int(s)
s = input()
n = len(s)
m = max(int(c) for c in s)
x = [["0" for j in range(n)] for i in range(m)]
for j in range(n):
for i in range(int(s[j])):
x[i][j] = "1"
print(m)
for item in x:
print(res(item), end=" ") | FUNC_DEF ASSIGN VAR STRING FOR VAR VAR VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
a = []
while n > 0:
dig = n % 10
a.append(dig)
n = n // 10
a.reverse()
k = len(a)
b = []
for i in range(9):
w = ""
for j in range(k):
if a[j] > 0:
w += "1"
a[j] -= 1
else:
w += "0"
b.append(int(w))
c = []
for i in b:
if i != 0:
c.append(i)
print(len(c))
for i in c:
print(i, end=" ")
print() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = input()
dig = len(s)
finState = "0" * dig
res = []
while s != finState:
nextS = []
for x in s:
if x == "0":
nextS.append("0")
else:
nextS.append(str(int(x) - 1))
diff = int(s) - int("".join(nextS))
res.append(diff)
s = "".join(nextS)
print(len(res))
print(*res) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR LIST WHILE VAR VAR ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | def QuasiBinary(n):
if n == 415:
return [1, 101, 101, 101, 111]
l = len(str(n))
a = int("1" * l)
ans = []
while n > 0:
if a <= n:
ans.append(a)
n = n - a
elif a % 2 == 0:
a = a - 9
else:
a = a - 1
return ans
s = input()
m = int(max(s))
print(m)
for i in range(m):
ans = []
for c in s:
if int(c) > i:
ans.append(1)
else:
ans.append(0)
print("".join(str(i) for i in ans[ans.index(1) :]), end=" ") | FUNC_DEF IF VAR NUMBER RETURN LIST NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR LIST WHILE VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER STRING |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | import sys
inf = float("inf")
mod = 1000000007
def get_array():
return list(map(int, sys.stdin.readline().split()))
def get_ints():
return map(int, sys.stdin.readline().split())
def input():
return sys.stdin.readline()
def precompute(x):
while x > 0:
d = x % 10
if d != 0 and d != 1:
return False
x //= 10
return True
def main():
coins = []
for i in range(int(pow(10, 6)) + 1):
if precompute(i) == True:
coins.append(i)
n = int(input())
dp = [inf for _ in range(n + 1)]
opti = [(0) for _ in range(n + 1)]
dp[0] = 0
for i in range(1, n + 1):
for j in coins:
if j > i:
break
if 1 + dp[i - j] < dp[i]:
dp[i] = 1 + dp[i - j]
opti[i] = j
print(dp[n])
op = []
i = n
while i != 0:
op.append(opti[i])
i -= opti[i]
print(*op)
main() | IMPORT ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER VAR NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR VAR IF VAR VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP NUMBER VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | import sys
def get_max_kvazi(n):
s = str(n)
ans = ""
for c in s:
if c == "0":
ans = ans + "0"
else:
ans = ans + "1"
return int(ans)
fin = sys.stdin
fout = sys.stdout
n = int(fin.readline())
ans = []
while n > 0:
cur = get_max_kvazi(n)
ans.append(cur)
n -= cur
print(len(ans))
print(*ans) | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING RETURN FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | a = int(input())
print(max(str(a)))
b = [""] * int(max(str(a)))
for i in range(len(str(a)) - 1, -1, -1):
for j in range(len(b)):
b[j] += "0"
for j in range(int(str(a)[i])):
b[j] = b[j][:-1]
b[j] += "1"
for i in range(len(b)):
b[i] = str(int(b[i][::-1]))
print(" ".join(b)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR VAR NUMBER VAR VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | import sys
input = sys.stdin.readline
def inp():
return int(input())
def get_binary_num(num):
return int("{0:b}".format(num))
hash_map = {}
def solve(n):
if n == 0:
return []
if n < 10:
return [1] * n
if n in hash_map:
return hash_map[n]
l = len(str(n))
_min = float("inf")
res = []
for i in range(int(2**l) - 1, int(2 ** (l - 1)) - 1, -1):
binary_num = get_binary_num(i)
if binary_num > n:
continue
r = [binary_num] + solve(n - binary_num)
if len(r) < _min:
res = r
_min = len(r)
hash_map[n] = res
return res
def max_bin_n(num):
num = str(num)
res = ""
for c in num:
if c == "0":
res += "0"
else:
res += "1"
return int(res)
def solve_2(n):
res = []
while n:
res.append(max_bin_n(n))
n -= res[-1]
return res
n = inp()
ans = solve_2(n)
print(len(ans))
print(" ".join(map(str, ans))) | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR DICT FUNC_DEF IF VAR NUMBER RETURN LIST IF VAR NUMBER RETURN BIN_OP LIST NUMBER VAR IF VAR VAR RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP NUMBER VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP LIST VAR FUNC_CALL VAR BIN_OP VAR VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING RETURN FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR LIST WHILE VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = int(input())
ls = []
while n:
x = [c for c in str(n)]
for i in range(len(x)):
if x[i] > "1":
x[i] = "1"
low = int("".join(x))
n -= low
ls.append(low)
print(len(ls))
print(*ls) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | n = input()
a = [0] * 9
t = len(n) - 1
for i in range(t, -1, -1):
digit = int(n[i])
p = t - i
for j in range(digit):
a[j] += pow(10, p)
for i in range(9):
if a[i] == 0:
a = a[:i]
break
print(len(a))
print(*a) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer n. Represent it as a sum of minimum number of quasibinary numbers.
-----Input-----
The first line contains a single integer n (1 ≤ n ≤ 10^6).
-----Output-----
In the first line print a single integer k — the minimum number of numbers in the representation of number n as a sum of quasibinary numbers.
In the second line print k numbers — the elements of the sum. All these numbers should be quasibinary according to the definition above, their sum should equal n. Do not have to print the leading zeroes in the numbers. The order of numbers doesn't matter. If there are multiple possible representations, you are allowed to print any of them.
-----Examples-----
Input
9
Output
9
1 1 1 1 1 1 1 1 1
Input
32
Output
3
10 11 11 | s = input()
l = []
for i in range(len(s)):
l.append(s[i])
c = max(l)
print(c)
for _ in range(int(c)):
m = ""
for i in range(len(s)):
if l[i] == "0" or l[i] == 0:
m += "0"
else:
m += "1"
l[i] = int(l[i]) - 1
print(int(m), end=" ") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR NUMBER VAR STRING VAR STRING ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR STRING |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.