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
s = input() m = 0 for c in s: m = max(m, int(c)) print(m) for i in range(m): flag = False for c in s: if int(c) > i: print(1, end="") flag = True elif flag: print(0, end="") print(" ", end="")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER STRING ASSIGN VAR NUMBER 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
k = list(map(lambda i: int(i), list(input()))) v = [] while sum(k) > 0: s = "" for i in range(len(k)): if k[i] > 0: k[i] -= 1 s += "1" else: s += "0" v.append(int(s)) print(len(v)) print(*v)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR STRING 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 k = list(map(int, list(sys.stdin.readline().strip()))) result = [] while any(k): quasi = 0 for digit in range(len(k)): quasi *= 10 if k[digit] > 0: quasi += 1 k[digit] -= 1 result.append(quasi) print(len(result)) for digit in result: print(digit, end=" ")
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER 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
x = int(input()) ans = [] while x >= 10: curr = "" for i in range(len(str(x))): if int(str(x)[i]) > 0: curr += "1" else: curr += "0" ans.append(curr) x -= int(curr) while x: ans.append(1) x -= 1 print(len(ans)) for i in ans: print(i, end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR WHILE VAR EXPR FUNC_CALL VAR NUMBER 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
import sys f = sys.stdin s = f.readline().strip() si = [] for i in range(len(s)): si.append(int(s[i])) r = [] for k in range(9): ki = 0 for i in range(len(si)): if si[i] > 0: si[i] -= 1 ki += 10 ** (len(si) - i - 1) if ki == 0: break r.append(str(ki)) print(len(r)) print(" ".join(r))
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL 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 BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR 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
L = list(input()) L = list(map(int, L)) N = len(L) ans = 0 ansl = [] while True: ret = "" for i in range(N): if L[i] != 0: ret += "1" L[i] -= 1 else: ret += "0" ret = int(ret) if ret == 0: break ans += 1 ansl.append(ret) print(ans) print(" ".join(map(str, ansl)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR 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()) s = "" ans = 0 while n: ans += 1 n1 = n mul = 1 num = 0 while n1: if n1 % 10: num += mul n1 //= 10 mul *= 10 n -= num s += str(num) + " " print(str(ans) + "\n" + s)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR IF BIN_OP VAR NUMBER VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR BIN_OP FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR 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
n = list(input()) arr = [int(i) for i in n] m = int(max(n)) print(m) for i in range(len(arr)): while arr[i] > 0: t = "" for j in range(i, len(arr)): if arr[j] > 0: t += "1" arr[j] -= 1 else: t += "0" print(t, end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR WHILE VAR VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING 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()) a = [x for x in range(1, n + 1)] l = len(str(n)) num = [0] stock = [ 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, 1000000, ] def run(nn): minA = 1000 next = 1001 for i in stock: if i > nn: break next = 1 + num[nn - i] if next < minA: minA = next num.append(minA) def factory(number): ret = 1 v1 = 1000 for i in stock: if i > nn: break v = num[number - i] + 1 if v1 > v: v1 = v ret = i return ret if n not in stock: for j in range(1, n + 1): run(j) ans = [] nn = n new = factory(nn) while n > 0: if num[new] != 1: nn -= new new = factory(nn) else: ans.append(new) n -= new nn = n if n > 0: new = factory(nn) print(len(ans)) print(*ans) else: print(1) print(n)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER 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 NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP NUMBER VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR IF VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER IF VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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
c = [int(x) for x in list(input())] print(max(c)) for _ in range(max(c)): d = [] for i in range(len(c)): if c[i] > 0: d.append("1") c[i] -= 1 else: d.append("0") print(int("".join(d)), end=" ") print("")
ASSIGN VAR FUNC_CALL VAR 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 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 VAR FUNC_CALL STRING VAR STRING EXPR FUNC_CALL 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()) n = list(n) l = len(n) m = int(max(n)) print(m) pseudo = [""] * m for i in n: i = int(i) for j in range(m): if j < i: pseudo[j] += "1" else: pseudo[j] += "0" pseudo = [int(k) for k in pseudo] pseudo = [str(k) for k in pseudo] print(" ".join(pseudo))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR STRING VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR 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() k = max([int(_) for _ in n]) arrVal = [] while int(n) != 0: tmp = "".join([("1" if int(i) > 0 else "0") for i in n]) n = str(int(n) - int(tmp)) arrVal.append(tmp) print(k) for val in arrVal: print(val, end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR NUMBER STRING STRING VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR 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()) m = [] while n: z = str(n) res = "" for i in range(len(z)): if z[i] > "0": res += "1" else: res += "0" m.append(res) n = n - int(res) print(len(m)) print(*m)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP 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 = int(input()) k = [] while n: k.insert(0, n % 10) n //= 10 cnt = max(k) ans = [0] * cnt for i in range(cnt): for j in k: ans[i] = ans[i] * 10 + (i < j) print(cnt) print(*ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR EXPR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR NUMBER 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() n = int(s) l = [] st = str(n) while n > 0: if st.count("1") + st.count("0") == len(st): l.append(int(st)) n = n - int(st) else: k = "" for i in st: if int(i) > 1: k += "1" else: k += i l.append(int(k)) n = n - int(k) st = str(n) print(len(l)) print(*l)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR NUMBER IF BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR STRING VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP 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 = int(input()) l = [] while n > 0: l.append(n % 10) n = n // 10 print(max(l)) m = max(l) for i in range(m): ma = max(l) a = 0 mu = 1 for j in range(len(l)): if l[j] == ma: l[j] -= 1 a += mu mu *= 10 print(a, end=" ") print()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR VAR VAR NUMBER 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
n = int(input()) digits = [] max_len = 0 while n: d = n % 10 if d > max_len: max_len = d digits.append(d) n //= 10 answer = [] for i, d in enumerate(digits): row = [10**i] * d + [0] * (max_len - d) answer.append(row) result = "" for j in range(max_len): result += str(sum([row[j] for row in answer])) + " " print(max_len) print(result)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST BIN_OP NUMBER VAR VAR BIN_OP LIST NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR 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
n = int(input()) a = [] while n > 0: a.append(n % 10) n //= 10 ans = 0 xs = [] if not a: ans = 1 xs = [0] while a: x = 0 for i in range(len(a)): if a[i] > 0: x += 10**i a[i] -= 1 xs.append(x) ans += 1 while a and a[-1] == 0: a.pop() print(ans) print(" ".join(map(str, xs)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER WHILE VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR BIN_OP NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER WHILE VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR 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()) l = list() ans = "" while n: ans = "".join(min(i, "1") for i in str(n)) l.append(ans) a = int(ans) n = n - a print(len(l)) print(*l)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING WHILE VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP 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() k = 0 a = [] while int(n) > 0: s = "" for x in n: if x == "0": s += "0" else: s += "1" n = str(int(n) - int(s)) a.append(s) k += 1 print(k) print(" ".join(a))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR 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
s = input() num = list() res = list() for i in s: num.append(int(i)) while True: tmps = "" for i, v in enumerate(num): if v > 0: num[i] -= 1 tmps += "1" else: tmps += "0" res.append(int(tmps)) if all(map(lambda x: x == 0, num)): break print(len(res)) print(" ".join(map(str, res)))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR WHILE NUMBER ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR NUMBER VAR STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER 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()) k = n ans = [] while k != 0: s = str(k) bin = "" for c in s: if c == "0": bin += "0" else: bin += "1" d = int(bin) ans.append(d) k -= d print(len(ans)) print(" ".join(map(str, ans)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING 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 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
def not_all_zero(vec): return any(vec) def take_row(vec): n = 0 for i, item in enumerate(vec): if item > 0: n += 10**i vec[i] -= 1 return n def main(): n = int(input()) digits = [] while n > 0: digits.append(n % 10) n //= 10 nums = [] while not_all_zero(digits): nums.append(take_row(digits)) print(len(nums)) print(" ".join(str(i) for i in nums)) main()
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR LIST WHILE FUNC_CALL 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 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 = int(input()) ans = [] while a > 0: t = a now = 0 x = 1 while t > 0: if t % 10 > 0: now = now + x x = x * 10 t = t // 10 ans = ans + [now] a = a - now print(len(ans)) for index in range(len(ans)): if index == len(ans) - 1: print(ans[index]) else: print(ans[index], 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 ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR LIST VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR 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
def main(): s = list(map(int, input())) ans = [] while max(s) != 0: t = [] for i in range(len(s)): t.append("1" if s[i] else "0") s[i] = max(0, s[i] - 1) ans.append(t) print(len(ans)) print(" ".join(["".join(_).lstrip("0") for _ in ans])) main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING STRING ASSIGN VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL STRING VAR STRING 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
ans = [] n = int(input()) while n: d = "".join(min(i, "1") for i in str(n)) n -= int(d) ans.append(d) print(len(ans)) print(*ans)
ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR STRING 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
a = list(input()) n = len(a) s = [] for i in range(0, n): a[i] = int(a[i]) b = [(["0"] * 9) for i in range(n)] for i in range(0, n): x = a[i] for j in range(0, x): b[i][j] = "1" for i in range(0, 9): c = 0 st = "" for j in range(0, n): if b[j][i] == "1": c += 1 if c > 0: st += b[j][i] if st == "": break else: s.append(st) print(len(s)) for i in range(0, len(s)): print(s[i], end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST STRING NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR STRING FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR STRING VAR NUMBER IF VAR NUMBER VAR VAR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER 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 = input() ans = max(int(c) for c in n) print(ans) vl = len(n) n = int(n) for i in range(ans): x = 0 for j in range(vl): dig = n % 10 ** (j + 1) // 10**j if dig != 0: n -= 10**j x += 10**j print(x, end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR 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()) num = [] for i in str(n): num.append(int(i)) ans = [] while max(num) != 0: val = 0 for i in range(len(num)): starting = 10 ** (len(num) - 1 - i) if num[i] > 0: val += starting num[i] -= 1 ans.append(val) print(len(ans)) print(*ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR IF VAR VAR NUMBER VAR VAR VAR 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()) result = [] while True: temp = str(n) ans = "" for i in range(len(temp)): if int(temp[i]) < 2: if temp[i] == "0": ans += "0" else: ans += "1" else: ans += "1" result.append(int(ans)) n -= int(ans) if n == 0: break print(len(result)) for i in range(len(result)): print(result[i], end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE 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 NUMBER IF VAR VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER 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
import sys n = int(input()) nums = [] while n != 0: num = 0 pow10 = 1 while n >= pow10: if n % (pow10 * 10) >= pow10: num += pow10 n -= pow10 pow10 *= 10 nums.append(num) print(len(nums)) print(" ".join(map(str, nums)))
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR VAR NUMBER EXPR 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 = input() digitlist = [] themax = 0 for dig in n: if int(dig) > themax: themax = int(dig) digitlist.append(int(dig)) print(themax) for i in range(themax): nextnum = "" firstone = False for j in range(len(digitlist)): if digitlist[j] > 0: nextnum = nextnum + "1" digitlist[j] = digitlist[j] - 1 firstone = True elif firstone == True: nextnum = nextnum + "0" print(nextnum, end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR STRING 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
import sys fin = sys.stdin n = int(fin.readline()) r = [] while n > 0: p10 = 1 cr = 0 while p10 <= n: if n // p10 % 10 != 0: cr += p10 n -= p10 p10 *= 10 r.append(cr) print(len(r)) for x in r: print(x, end=" ")
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR VAR VAR VAR VAR NUMBER 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
digits = list(map(int, list(input()))) max_len = max(digits) answer = [] for i, d in enumerate(reversed(digits)): row = [10**i] * d + [0] * (max_len - d) answer.append(row) result = "" for j in range(max_len): result += str(sum([row[j] for row in answer])) + " " print(max_len) print(result)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST BIN_OP NUMBER VAR VAR BIN_OP LIST NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR 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
n = int(input()) digs = [int(i) for i in str(n)] x = max([int(i) for i in str(n)]) print(x) tenpow = len(str(n)) - 1 ans = [0] * x for i in range(len(digs)): for j in range(digs[i]): ans[j] += 10**tenpow tenpow -= 1 print(*ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP NUMBER VAR VAR 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
n = input() numbs = [""] * 9 for k in range(9): for j in range(len(n)): if int(n[j]) >= k + 1: numbs[k] += "1" else: numbs[k] += "0" s = 0 res = "" for k in range(9): if int(numbs[k]) != 0: s += 1 res += str(int(numbs[k])) + " " print(s) print(res)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR VAR STRING VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR 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
def main(): l, res = list(map(int, input()))[::-1], [] while l: tmp, start = [], -1 for i, a in enumerate(l): if a: tmp.append("1") l[i] = a - 1 else: tmp.append("0") res.append("".join(tmp[::-1])) while l and not l[-1]: del l[-1] print(len(res)) print(" ".join(res)) main()
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER LIST WHILE VAR ASSIGN VAR VAR LIST NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING 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
def qasi(n): if n == 0: print(1) print(0) return c = 0 l = [] while n >= 1: s = str(n) ans = "" for x in s: if x != "0": ans += "1" else: ans += "0" n -= int(ans) s += ans c += 1 l.append(ans) print(c) for x in l: print(x, end=" ") print() return t = int(input()) qasi(t)
FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR RETURN ASSIGN VAR FUNC_CALL 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
from sys import stdin, stdout input = stdin.readline n = list(input()[:-1]) ma = "0" s = 0 for i in n: if i > ma: ma = i s += int(i) stdout.write(ma + "\n") while s: f = False ans = "" for i in range(len(n)): d = "0" if not f and n[i] == "0": n.pop(i) break elif n[i] != "0": s -= 1 d = "1" f = True n[i] = str(int(n[i]) - 1) ans += d if f: stdout.write(ans + " ")
ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR STRING WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING IF VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR VAR IF VAR EXPR FUNC_CALL VAR BIN_OP 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 = list(map(int, input())) print( str(max(n)) + "\n" + " ".join( [ "".join([("1" if i < e else "0") for e in n]).lstrip("0") for i in range(max(n)) ] ) )
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR STRING FUNC_CALL STRING FUNC_CALL FUNC_CALL STRING VAR VAR STRING STRING VAR VAR STRING VAR 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
def main(): string = str(input()) arr = [int(x) for x in string] mx = max(arr) print(mx) for _ in range(mx): res = "" for i in range(len(arr)): if arr[i] > 0: res += "1" arr[i] -= 1 else: res += "0" for i in range(len(res)): if res[i] == "1": break print(res[i:], end=" ") main()
FUNC_DEF ASSIGN VAR FUNC_CALL 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 FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING 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
a = input() if max(a) > "1": a = list(a) m = int(max(a)) print(int(max(a))) l = len(a) for i in range(0, m): temp = 0 for j in range(l): if a[j] != "0": t = int(a[j]) temp += 1 * 10 ** (l - j - 1) t = t - 1 a[j] = str(t) print(temp, end=" ") else: print(1) print(int(a))
ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR NUMBER 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 = input().strip() m = max([int(i) for i in n]) print(m) for i in range(m): print(int("".join([("1" if int(j) > i else "0") for j in n])), end=" ")
ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR STRING STRING 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 fin(n): lis = list(str(n)) ll = len(lis) no = [0] * ll for i in range(ll): if lis[i] >= "1": no[i] = "1" else: no[i] = "0" kk = int("".join(no)) return kk n = int(input()) c = 0 ans = [] while n > 0: aa = fin(n) ans.append(aa) n -= aa c += 1 print(c) print(*ans)
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR STRING ASSIGN VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR 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
import sys n = int(input()) if n == 0: print(1) print(0) sys.exit() t = n digits = [] big = 0 while t != 0: digit = t % 10 big = max(big, digit) digits.insert(0, digit) t //= 10 numbers = [(0) for x in range(big)] for k in range(len(digits)): for i in range(big): numbers[i] *= 10 if digits[k] > 0: numbers[i] += 1 digits[k] -= 1 print(big) print(*numbers)
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR VAR NUMBER 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
n = input() if len(n) == 1: if ord(n) == 48: print(1) print(n) elif 48 < ord(n) <= 57: print(n) print("1 " * int(n)) else: flag = 0 for i in n: if i != "1" and i != "0": flag = 1 break if flag == 0: print(1) print(n) else: result = [] while int(n) != 0: number = [] for i in n: if i == "0": number.append("0") else: number.append("1") result.append("".join(number)) number = "".join(number) n = str(int(n) - int(number)) print(len(result)) print(*result, sep=" ")
ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR IF NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL STRING 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 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 get_numbers(n): binary = [] new_n = [] for char in str(n): if int(char) != 0: binary.append("1") new_n.append(str(int(char) - 1)) else: binary.append("0") new_n.append(char) if int("".join(new_n)) == 0: return ["".join(binary)] else: return ["".join(binary)] + get_numbers(int("".join(new_n))) num = int(input()) fact = get_numbers(num) print(len(fact)) print(" ".join(fact))
FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER RETURN LIST FUNC_CALL STRING VAR RETURN BIN_OP LIST FUNC_CALL STRING VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL 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 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() x = int(max(n)) print(x) l = [*map(int, n)] res = [([0] * len(l)) for _ in range(max(l))] for i in range(x): for j in range(len(l)): if l[j] > 0: l[j] -= 1 res[i][j] += 1 res = [int("".join(map(str, e))) for e in res] print(*res, sep=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR 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()) tem = n arr = [] while tem > 0: x = tem z = 0 l = 0 while x > 0: y = x % 10 if y > 0: z = (z + 1) / 10 else: z = z / 10 l += 1 x = x // 10 z = int(z * 10**l) tem += -z arr.append(z) print(len(arr)) for i in arr: print(i, end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER 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
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() n1 = len(n) k = 0 for i in range(n1): if int(n[i]) > k: k = int(n[i]) print(k) l = [] for i in range(k): l.append("") for i in range(n1): for j in range(int(n[i])): l[j] += "1" for j in range(int(n[i]), k): l[j] += "0" def fix(l): l1 = len(l) p = [] for i in range(l1): s = 0 if l[i][0] == "0": j = 1 r = len(l[i]) s = 1 while j < r: if l[i][j] == "0": s += 1 else: break j += 1 p.append(s) for i in range(l1): if p[i] > 0: m = "" r = len(l[i]) for j in range(p[i], r): m += l[i][j] l[i] = m return l fix(l) for i in range(k): print(l[i], "", end="") if k == 0: print(k)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR NUMBER STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR STRING VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR RETURN VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING STRING IF VAR 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
n = list(reversed(input())) outs = [0] * 9 for i in range(len(n)): for x in range(int(n[i])): outs[x] += 10**i outs = list([_f for _f in outs if _f]) print(len(outs)) print(*outs)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR 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()) m = 0 c = 1 i = n while i > 0: m = max(m, i % 10) i = i // 10 a = [0] * m i = n while i > 0: for j in range(i % 10): a[j] += c c = c * 10 i = i // 10 print(m) for i in range(m): print(a[i], end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR WHILE VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR FOR 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
def get_ner(n): k = 0 while True: res = int(str(bin(k + 1))[2:]) if res > n: break k += 1 return int(str(bin(k))[2:]) n = int(input()) ans = [] while n != 0: k = n m = 0 p = 1 while k != 0: if k % 10 != 0: m += p k //= 10 p *= 10 ans.append(m) n -= m print(len(ans)) print(*ans)
FUNC_DEF ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR NUMBER RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER 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 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
import sys input = sys.stdin.readline inf = int(10000000000.0) n = int(input()) ans = [] while n: a = n d = 0 c = 0 while a: r = a % 10 if r != 0: d += 10**c c += 1 a //= 10 n -= d ans.append(d) print(len(ans)) print(*ans)
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER 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 BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER 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()) k = 0 S1 = [] S = str(n) S2 = [] while sum(S1) < n: v = "" for i in range(len(S)): if S[i] == "0" and v != "": v = v + S[i] elif S[i] != "0": v = v + "1" S = S[:i] + str(int(S[i]) - 1) + S[i + 1 :] if v != "": S1.append(int(v)) k = k + 1 print(k) for i in range(k): S2.append(str(S1[i])) print(" ".join(S2))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR 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
def tostr(l): l = l[l.index(1) :] s = "" for i in l: s += str(i) return s n = int(input()) ml = len(str(n)) l = [int(i) for i in str(n)] l1 = [] c = 0 while len(l) > 0: x = l[0] l.remove(x) i = 0 x1 = x while i < len(l1) and x1: l1[i][c] = 1 i += 1 x1 -= 1 while len(l1) < x: l1.append([0] * (ml - len(l) - 1) + [1] + [0] * len(l)) c += 1 print(len(l1)) l2 = [] for i in l1: l2.append(tostr(i)) print(*l2)
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER WHILE FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP LIST NUMBER BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUMBER LIST NUMBER BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR 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()) b = a n = 0 sp = [] kol = 0 maxi = 0 while b > 0: k = b % 10 if k > maxi: maxi = k sp.append(k) n += 1 b = b // 10 print(maxi) s = 0 for i in range(maxi): for j in range(n): if sp[j] > 0: sp[j] -= 1 s += 10**j print(s, end=" ") s = 0
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR STRING ASSIGN 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
a = [int(i) for i in input()] tmp = max(a) ans = [] for i in range(tmp): temp = [] for i in range(len(a)): if a[i] > 0: a[i] -= 1 temp.append("1") else: temp.append("0") ans.append(int("".join(temp))) print(len(ans)) for i in ans: print(i, end=" ")
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING 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
s = input() lst = [] for i in s: lst.append(int(i)) lst2 = [""] * max(lst) n = max(lst) m = len(lst) lst = lst[::-1] for i in lst: for j in range(i): lst2[j] = "1" + lst2[j] for j in range(i, n): lst2[j] = "0" + lst2[j] for i in range(n): curr = lst2[i] index = 0 for j in range(m): if curr[j] == "1": index = j break lst2[i] = curr[index:] print(n) print(" ".join(lst2))
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP STRING VAR VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP STRING VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR VAR VAR 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
x = list(input()) r = [] while int("".join(x)) > 0: v = [] for i, val in enumerate(x): if int(val) > 0: v.append("1") x[i] = str(int(val) - 1) else: v.append("0") r.append(int("".join(v))) x = list(str(int("".join(x)))) print(len(r)) for x in r: print(x, end=" ") print()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING 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
def main(): number = int(input()) quasi_list = [(0) for _ in range(9)] digitpos = 0 n = number while n > 0: digit = n % 10 n = n // 10 for i in range(digit): quasi_list[i] += 10**digitpos digitpos += 1 while quasi_list[-1] == 0: quasi_list.pop() print(len(quasi_list)) quasi2str = list(map(str, quasi_list)) print(" ".join(quasi2str)) main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP NUMBER VAR VAR NUMBER WHILE VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING 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
p = int(input()) a = [int(x) for x in str(p)] n, m = len(a), max(a) ans = [(["0"] * n) for i in range(m)] for i in range(n): for j in range(a[i]): ans[j][i] = "1" print(m) print(*[int("".join(ans[i])) for i in range(m)])
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR 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 VAR VAR ASSIGN VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR 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
answer = [] n = input() n = int(n) while n: temp, num, m = n, 0, 1 temp = int(temp) while temp: if temp % 10: num += m temp = temp // 10 m = m * 10 answer.append(num) n = n - num print(len(answer)) for i in range(0, len(answer)): print(answer[i], end=" ") print()
ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR IF BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER 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
a = input() j = 0 b = [] for i in a: if j < int(i): j = int(i) print(j) for i in range(j): b.append(0) mult = 1 for i in a[::-1]: for k in range(int(i)): b[k] += mult mult *= 10 for i in range(j): print(b[i], end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER FOR 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
def main(): n = input() quasib = resuelve(n) print(len(quasib)) print(*quasib) def resuelve(cadena: str) -> [int]: lista = [] if not cadena: return lista else: n = int(cadena) binario = 0 while n > 0: binario = get_binario(n) lista.append(binario) n = n - binario return lista def get_binario(entrada: int) -> int: entrada = str(entrada) cifras = len(entrada) num = 0 for i in entrada: cifras = cifras - 1 if i != "0": num = num + 10**cifras return num main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF VAR ASSIGN VAR LIST IF VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN VAR LIST VAR FUNC_DEF VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR RETURN 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
n = int(input()) str_n = str(n) nums = [] for i in range(max([int(i) for i in str_n])): nums.append([]) for __ in range(len(str_n)): nums[i].append("0") for i in range(len(str_n)): c = int(str_n[i]) for j in range(c): nums[j][i] = "1" ans = [] for i in nums: ans.append(int("".join(i))) print(len(ans)) for i in ans: print(i, end=" ") print()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING 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 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
n = input() l = [int(x) for x in n] print(max(l)) n = int(n) res = [] while n > 0: m = 0 for i in range(len(l)): m *= 10 if l[i] != 0: m += 1 l[i] -= 1 n -= m res.append(m) for i in res: print(i, end=" ") print()
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER VAR VAR EXPR 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
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 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
def check_quasi_binary(number): number_str = str(number) result = True for char in number_str: if not (char == "0" or char == "1"): result = False break return result def find_max_quasi_binary(number): number_str = str(number) result = "" for char in number_str: if char != "0": result += "1" else: result += "0" return int(result) n = int(input()) quasi_binary_sum = [] while n > 0: max_quasi_binary = find_max_quasi_binary(n) quasi_binary_sum.append(max_quasi_binary) n -= max_quasi_binary print(len(quasi_binary_sum)) print(" ".join([str(x) for x in sorted(quasi_binary_sum)]))
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING ASSIGN VAR NUMBER 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 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 FUNC_CALL STRING FUNC_CALL VAR VAR 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 = int(input()) ans = [] while n: t = 0 for i in range(len(str(n))): if n // 10**i % 10: t += 10**i ans.append(str(t)) n -= t print("{0}\n{1}".format(len(ans), " ".join(ans)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR 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 conv(ele): return int("".join(ele)) n = input() int_n = int(n) ans = max([int(i) for i in n]) seq = [] for i in n: seq.append(["1" for i in range(int(i))] + ["0" for i in range(ans - int(i))]) ans_seq = [[i[j] for i in seq] for j in range(ans)] ans_seq = list(map(conv, ans_seq)) print(ans) print(*ans_seq)
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL STRING 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 LIST FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL 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()) d_n = {} t_n = n m = 0 i = 0 while t_n > 0: i = max(1, i * 10) d_n[i] = t_n % 10 t_n //= 10 m = max(d_n[i], m) print(m) for _ in range(m): t_i = i o = 0 while t_i > 0: o *= 10 o += 1 if d_n[t_i] > 0 else 0 d_n[t_i] -= 1 t_i //= 10 print(o, end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR VAR VAR NUMBER NUMBER NUMBER VAR VAR NUMBER 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
x = input() k = [(["0"] * len(x)) for _ in range(10)] ct = 0 maxx = 0 for i in x: for j in range(int(i)): k[j][ct] = "1" ct += 1 maxx = max(maxx, int(i)) print(maxx) for i in range(maxx): print(int("".join(k[i])), end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING 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
__author__ = "Данила" n = input() a = [] s = int(n) min = 0 for i in range(len(n)): if int(n[i]) > min: min = int(n[i]) print(min) while s != 0: s1 = str(s) k = "" for i in range(len(s1)): if s1[i] != "0": k += "1" else: k += "0" print(k, end=" ") s -= int(k)
ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN 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 FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR VAR STRING 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
def main(): N = int(input()) a = [] while N: num = N counter = 0 count = 1 while num: if num % 10: counter += count num //= 10 count *= 10 a.append(counter) N -= counter print(len(a)) a.sort() for item in a: print(int(item), end=" ") main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR IF BIN_OP VAR NUMBER VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR 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
n = list(map(int, input())) ans = [] while True: num = "" for i in range(len(n)): if n[i] > 0: num += "1" n[i] -= 1 else: num += "0" num = int(num) if num == 0: break else: ans.append(num) print(len(ans)) print(" ".join(map(str, ans)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR STRING VAR VAR NUMBER VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR 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(i) for i in input()] ans = [] while sum(n) > 0: s = "" for i in range(len(n)): if n[i] == 0: if len(s) != 0: s = s + "0" else: s = s + "1" n[i] -= 1 ans.append(s) print(len(ans)) print(" ".join(ans))
ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING 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
n = input() B = [(0) for i in range(7)] while len(n) != 7: n = "0" + n ans = 0 for i in range(7): ans = max(ans, int(n[i])) B[i] = int(n[i]) print(ans) s = "" for i in range(ans): cur = [(0) for i in range(7)] for j in range(7): if B[j] > 0: cur[j] = 1 B[j] -= 1 was = False for j in range(7): if cur[j] == 1: s += "1" was = True elif was: s += "0" s += " " print(s[:-1])
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING VAR STRING EXPR FUNC_CALL VAR 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
def to(n): return int(bin(n)[2:]) def main(): n = int(input()) ar = [] x = 1 while to(x) <= n: ar.append(to(x)) x += 1 d = [10**7] * (n + 1) c = [[] for i in range(n + 1)] for i in ar: d[i] = 1 c[i] = [i] for i in range(1, n + 1): for j in ar: if d[i - j] + 1 < d[i]: d[i] = d[i - j] + 1 c[i] = c[i - j] + [j] print(d[n]) print(*c[n]) main()
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST BIN_OP NUMBER NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR LIST VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR VAR IF BIN_OP VAR BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR VAR LIST VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR 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
x = int(input()) ps = [] while x: p = 0 l = len(str(x)) for i, c in enumerate(str(x)): if c != "0": p += 10 ** (l - i - 1) x -= p ps.append(p) print(len(ps)) print(" ".join(map(str, ps)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR STRING VAR BIN_OP NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR 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 = list(map(int, input())) abc = [] while n.count(0) < len(n): ans = "" for i in range(len(n)): if n[i] != 0: ans += "1" n[i] -= 1 else: ans += "0" abc.append(ans) print(len(abc)) for j in range(len(abc)): if abc[j][0] == "0": for k in range(len(abc[j])): if abc[j][k] != "0": abc[j] = abc[j][k:] break print(*abc)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR NUMBER 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 VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR STRING ASSIGN VAR VAR 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
s = input() n = len(s) a = [] for ch in s: a.append(int(ch)) ans = max(a) print(ans) for i in range(ans): num = 0 for j in range(n): num *= 10 if a[j] > 0: num += 1 a[j] -= 1 print(num, end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR NUMBER 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 = int(input()) def nearest(n): instr = str(n) length = len(instr) to_ret = 10 ** (length - 1) for i in range(1, length): if int(instr[i]) >= 1: to_ret += 10 ** (length - i - 1) return to_ret i = 0 chisla = [] while n != 0: d = nearest(n) chisla.append(d) n -= d i += 1 print(i) for c in range(i): print(chisla[c], end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF FUNC_CALL VAR VAR VAR NUMBER VAR BIN_OP NUMBER BIN_OP BIN_OP VAR VAR NUMBER RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FOR 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 = list([int(i) for i in input()]) numbers = max(n) number_list = [] for number in range(numbers): temp_number = [] for index in range(len(n)): if n[index] == 0: temp_number.append(0) else: temp_number.append(1) n[index] -= 1 number_list.append(int("".join([str(i) for i in temp_number]))) print(numbers) print(" ".join([str(i) for i in number_list]))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR 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 EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING 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 = int(input()) res = [] while n > 0: sn = str(n) tmp = "" for e in map(int, sn): tmp += "1" if e >= 1 else "0" n -= int(tmp) res.append(tmp) print(len(res)) print(*res)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER STRING STRING 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
s = input() print(int(max(s))) for i in range(int(max(s))): res = "" for c in s: if i + 1 <= int(c): res += "1" else: res += "0" print(int(res), end=" ") print()
ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR IF BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR STRING VAR STRING EXPR FUNC_CALL VAR 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
def qBinary(n): a = list(str(n)) a = list(map(int, a)) b = [0] * max(a) for i in range(len(a)): j = 0 while a[i] > 0: b[j] += 10 ** (len(a) - i - 1) j += 1 a[i] -= 1 print(len(b)) for i in b: print(i, end=" ") n = int(input()) qBinary(n)
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL 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
n = input() ans = "" count = 0 while int(n) != 0: tmp = "" for i in n: if int(i) > 0: tmp += "1" else: tmp += "0" ans = ans + tmp + " " count += 1 n = str(int(n) - int(tmp)) print(count) print(ans)
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR STRING VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL 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
n = input() k = max(n) print(k) for _ in range(1, int(k) + 1): f = "" for i in n: if int(i) >= _: f += "1" else: f += "0" print(int(f), end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR VAR 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
log = lambda *x: print(*x) def cin(*fn, def_fn=str): i, r = 0, [] if fn: def_fn = fn[0] for c in input().split(" "): r += [(fn[i] if len(fn) > i else def_fn)(c)] i += 1 return r def q(n): c, ln = 0, 0 while n: l = n % 10 if ln == 0: c = l if l == 0 else 1 elif l != 0: c = 1 * 10**ln + c ln += 1 n //= 10 return c def minQ(t): a = [] while t: v = q(t) a += [v] t -= v return a (n,) = cin(int) r = minQ(n) log(len(r)) log(" ".join(str(c) for c in r))
ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF VAR ASSIGN VAR VAR NUMBER LIST IF VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR STRING VAR LIST FUNC_CALL FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR LIST WHILE VAR ASSIGN VAR FUNC_CALL VAR VAR VAR LIST VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR 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 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()) l = [] while n != 0: s = "" for i in list(str(n)): if i == "0": s += "0" else: s += "1" n -= int(s) l.append(int(s)) print(len(l)) print(*l)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRING VAR FUNC_CALL VAR VAR 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
inp = input() L = [] while int(inp) > 0: toa = "" for i in inp: if i != "0": toa += "1" else: toa += "0" inp = str(int(inp) - int(toa)) L.append(int(toa)) print(len(L)) for i in L: print(i, end=" ")
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING 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 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
digits = list(map(int, list(input()))) quasis = list() for x in range(max(digits)): nextQuasi = "" for y in range(len(digits)): if digits[y] > 0: nextQuasi += "1" digits[y] -= 1 else: nextQuasi += "0" quasis.append(int(nextQuasi)) print(len(quasis)) print(" ".join(map(str, quasis)))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 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
3 def main(): s = list(map(int, input())) ans = [[1]] while ans[-1] != [(0) for i in range(len(s))]: ans.append([(0) for i in range(len(s))]) for i in range(len(s)): if s[i] > 0: ans[-1][i] = 1 s[i] -= 1 print(len(ans) - 2) for i in range(1, len(ans) - 1): print(int("".join(map(str, ans[i]))), end=" ") print() main()
EXPR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER WHILE VAR NUMBER NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR 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
n = int(input()) a = [] while n > 0: x = n b = [] while x: if x % 10: b.append("1") else: b.append("0") x //= 10 b = int("".join(b[::-1])) a.append(b) n -= b print(len(a)) print(*sorted(a)[::-1])
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST WHILE VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR 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
__author__ = "girish" def find(n): li = list(map(int, n)) all = max(li) ansL = [[] for _ in range(all)] now_max = li[0] for i in li: if now_max < i: now_max = i for it in range(now_max): if it < i: ansL[it].append("1") else: ansL[it].append("0") for w in range(len(ansL)): ansL[w] = "".join(ansL[w]) print(len(ansL)) return " ".join(ansL) print(find(input()))
ASSIGN VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL STRING VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR RETURN FUNC_CALL STRING VAR EXPR FUNC_CALL VAR FUNC_CALL VAR 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 = list(map(int, list(input().strip()))) print(max(s)) while s: if s[0] == 0: s = s[1:] continue for i in range(len(s)): if s[i] != 0: print(1, end="") s[i] -= 1 else: print(0, end="") print(end=" ")
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR WHILE VAR IF VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER STRING EXPR FUNC_CALL 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()) qb = [ 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, 1000000, ] k = [[float("inf"), 0] for _ in range(n + 1)] k[0][0] = 0 k[0][1] = 0 for i in range(1, n + 1): for j in qb: if i - j < 0: break if k[i][0] > k[i - j][0] + 1: k[i][0] = k[i - j][0] + 1 k[i][1] = j print(k[n][0]) i = n j = k[n][1] while i != 0: print(j, end=" ") i = i - j j = k[i][1] print("")
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 NUMBER ASSIGN VAR LIST FUNC_CALL VAR STRING NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER BIN_OP VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR NUMBER WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL 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()) numbers = [] while n != 0: digits = list(str(n)) next_number = int("".join(list("1" if digit != "0" else "0" for digit in digits))) numbers.append(next_number) n -= next_number print(len(numbers)) print(" ".join(str(number) for number in numbers))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR STRING STRING STRING VAR VAR EXPR 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 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
ans = [] def reduce(x): ans = "" for i in x: if int(i) > 1: ans += "1" else: ans += i return int(ans) def res(x): global ans m = reduce(str(x)) ans.append(m) if m == x: return 1 else: x = x - m return 1 + res(x) n = int(input()) print(res(n)) for i in ans: print(i, end=" ")
ASSIGN VAR LIST FUNC_DEF ASSIGN VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR STRING VAR VAR RETURN FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP VAR VAR RETURN BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING