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

Ekspert

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

의견: 0

설명

The group stage of the World Cup has ended, the teams are ready for the knockout
stage, and many experts are trying to figure out the next world champion. One of
them is Boris, the man who correctly determined the last four world champions.
Lower the chances \(of\) this team because they have \(a\) player \(of\) Barcelona, raise the
chances \(of\) that team beacuse they have the captain \(of\) Real Madrid... - Boris is
calucati\(ng - No\)w \(I\) only need \(to\) multiply the integers x and y , and the \(I\) can
announce the next world champion.
The audience suddenly got very quiet. They are impatienly waiting to know if Croatia is going to win.
Boris will multiply \(x\) and \(y\) using his famous method of four registers.
He has four register: A, B, C and D. Initially they have the values: \(x\), \(y\), 0 and 1, respectively. The only
operation he is allowed to do is summing up two registers (possibly the same) and storing the result in
one of the registers. Each of the registers can have the value of at most \(2 \cdot 10^{18}\).
He doesn’t want the audience to wait too long, so he can make at most 100 of such operations.
Help him determine the operations he needs to do, and in which of the registers will the final result be
stored.

제약

Subtask 1 (14 points): x, \(y \le 50\)

Subtask 2 (14 points): \(x \cdot y \le 10^{4}\)

Subtask 3 (42 points): No additional constraints.

입력 형식

The first and only line contains positive integers \(x\) and \(y\) (\(1 \le x \cdot y \le 10^{18}\)), the numbers Boris needs to
multiply.

출력 형식

In the first line output the integer \(n\) (\(0 \le n \le 100\)), the number of operations Boris needs to do.
In the \(i-th\) of the following \(n\) lines output the operation in the format R1 R2 R3, where R_{j} is the label of
the register (A, B, C or D), and the operation means the sum of R1 and R2 will be stored in R3.
If there are multiple correct solutions, output any of them. The solution doesn’t need to have the minimal
number of operations.

서브태스크
서브태스크점수설명

1

14점

x, \(y \le 50\)

2

14점

\(x \cdot y \le 10^{4}\)

3

42점

No additional constraints.

예제 1
입력
1 2
출력
1
A A A
A
예제 2
입력
3 2
출력
6
D C C
D C C
D C C
D C C
D C C
D C C
C
설명

Clarification of the first example:
The values of the registers (A, B, C, D) after the i-th operation are:
0: (1, 2, 0, 1) - initial state
1: (2, 2, 0, 1) - after the operation A A A
The product of 1 and 2 is in the register with label A.
Clarification of the second example:
The values of the registers (A, B, C, D) after the i-th operation are:
0: (3, 2, 0, 1) - initial state
1: (3, 2, 1, 1) - after the operation D C C
2: (3, 2, 2, 1) - after the operation D C C
3: (3, 2, 3, 1) - after the operation D C C
4: (3, 2, 4, 1) - after the operation D C C
5: (3, 2, 5, 1) - after the operation D C C
6: (3, 2, 6, 1) - after the operation D C C
The product of 2 and 3 is in the register with label C.

문제 정보

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

출처 COCI 2022/2023 Contest 2

평가 및 의견

Ekspert

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

Log in to rate problems.

개별 의견

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

풀이 제출

Ekspert

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