Vasya has his favourite number nn. He wants to split it to some non-zero digits. It means, that he wants to choose some digits d1,d2,…,dkd1,d2,…,dk, such that 1≤di≤91≤di≤9 for all ii and d1+d2+…+dk=nd1+d2+…+dk=n.
Vasya likes beauty in everything, so he wants to find any solution with the minimal possible number of different digits among d1,d2,…,dkd1,d2,…,dk. Help him!
Input
The first line contains a single integer nn — the number that Vasya wants to split (1≤n≤10001≤n≤1000).
Output
In the first line print one integer kk — the number of digits in the partition. Note that kk must satisfy the inequality 1≤k≤n1≤k≤n. In the next line print kk digits d1,d2,…,dkd1,d2,…,dk separated by spaces. All digits must satisfy the inequalities 1≤di≤91≤di≤9.
You should find a partition of nn in which the number of different digits among d1,d2,…,dkd1,d2,…,dk will be minimal possible among all partitions of nn into non-zero digits. Among such partitions, it is allowed to find any. It is guaranteed that there exists at least one partition of the number nn into digits.
문제 적당히 이해는 했는데 명확히 뭘 말하는지 몰라서 좀 해맸다. 숫자 주어지면 이걸 ㅁ + ㅁ + ㅁ 이런 식으로 나누는데 가능한 숫자를 최소로 해라 ~~ 그런데 문제는 가능한 숫자를 최소로 하라는게 무슨 뜻인지 몰라서 아 ㅁ + ㅁ <- 이 ㅁ의 개수를 최소로 하라는 건가? 아니면 ㅁ의 종류를 최소로 하라는 건가?? 뭐지?? 뭐지?? 하다가 아래 Note 보고 ㅁ의 개수를 최소화 하라는 걸 알았다. 그런데 그럼 그냥 다 1을 출력하면 되는 거 아닌가?? 너무 쉬운데?? 진짜 이건가?? 하면서 또 고민함
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
using namespace std;
using i64 = long long;
//printf("%d", );
//scanf("%d", &);
//printf("\n");
int main() {
int n;
scanf("%d", &n);
printf("%d\n", n);
for(int i = 0; i < n; i++)
printf("1 ");
return 0;
}
1 출력하면 되더라... Accecpt 뜬 거 보고도 좀 놀랬음 (아 진짜 이거라고??)
'코드포스' 카테고리의 다른 글
[코드포스 Practice5] C. Mind the Gap (0) | 2019.11.27 |
---|---|
[코드포스 Practice5] B. Oath of the Night's Watch (0) | 2019.11.27 |
[코드포스 Practice5] 후기 (0) | 2019.11.27 |
[코드포스 Practice4] E. Modular Equations (0) | 2019.11.20 |
[코드포스 Practice4] D. Vasya and Football (0) | 2019.11.20 |