CF538B.Quasi Binary
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
一个数被称为拟二进制数(quasibinary),如果其十进制表示中仅包含数字 0 或 1。例如,数 0、1、101、110011 是拟二进制数,而 2、12、900 不是。
给定一个正整数 n,将其表示为最少个数的拟二进制数之和。
输入格式
The first line contains a single integer n (1 ≤ n ≤ 106).
第一行包含一个整数 n(1≤n≤106)。
输出格式
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.
第一行输出一个整数 k —— 将数 n 表示为若干拟二进制数之和时所需的最少数字个数。
第二行输出 k 个数 —— 这些加数。根据上述定义,所有这些数都必须是拟二进制数,且它们的和应等于 n。输出时无需保留数字前导的零。加数的顺序无关紧要。若存在多种可能的表示方式,输出任意一种即可。
输入输出样例
输入#1
9
输出#1
9 1 1 1 1 1 1 1 1 1
输入#2
32
输出#2
3 10 11 11
输入解题思路,AI测评打分。不知道怎么写?