RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00482

Kotrljanje

Unrated 레이팅 미적용
난이도
2s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

2 \(s / 64\) \(MB / 140\) points

V\(la-tk\)o, V\(la-tk\)o, V\(la-tk\)o!

Nobody comes to Vlatko’s office hours anymore. Angered, enraged and disgruntled, Vlatko’s

revenge is a convenient task for COCI:

You are given an infinite arithmetic sequence A(n) = \(Cn + D\) , defined for all natural numbers

\(n\) . We want find a sequence of \(M\) distinct natural numbers \(n\) {1}{ }, n {2}{ }, ..., n _{M} less than or equal to

10 ^{15} such that the corresponding members of sequence A(n {1}{ }), A(n {2}{ }), ..., A(n {M}{ }) all have the

same sum of digits in base \(B\) .

Please note: Every positive integer N can be written in base B as follows: create the unique

string \(x\) {k}{ }\(x\) {\(k-1\)}{ }...x {1}{ }\(x\) {0}{ }, where 0 ≤ \(x\) {i} < \(B\) for each \(i\) , and the equation \(x\) \(k-1\)">{ }\(B\) ^{k} + x { }\(B\) ^{\(k-1\)} + ... + \(x\) { }\(B + x\) =

\(N\) is satisfied . The sum of digits is given with \(x\) {k}{ } + ... + x {0}{ }.

제약
입력 형식

The first line of input contains four integers \(C\) , \(D\) , \(B\) and \(M\) (1 ≤ C, \(D\) ≤ 10000, \(2 \le B \le 5000\) , 1
\(M\) ≤ 250000).

출력 형식

The first and only line of output must contain the required numbers, separated by spaces, in

an arbitrary order.
Please note: you must output the numbers \(n\) {i}{ }, not numbers A(n {i}{ }) . All numbers in the

output should be less than or equal to 10 {15}{ }.
The input data will be such that a solution that meets the given conditions exists.

예제 1
입력
5 3 2 2

2 1 10 3
출력
output
2 5
2 20 200
설명

Clarification of the test cases:
In the first test case, one of the possible sequences is the sequence in the output. The corresponding

members of the arithmetic sequence are 5 * 2 + 3 = 13 and 5 * 5 + 3 = 28. The format of number 13 in

base 2 is 1101, whereas the format of number 28 in base 2 is 11100. The sum of digits in both

formats is equal to 3.

In the second test case, the corresponding members of the sequence are 2 * 2 + 1 = 5, 2 * 20 + 1 =

41, and 2 * 200 + 1 = 401. Each of the numbers’ digits, written in base 10, sum up to 5.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2017/2018 Contest 6

평가 및 의견

Kotrljanje

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Kotrljanje

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8