QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#18888. A cộng bằng B

Statistics

$A+B$ là một bài toán dùng để kiểm tra kiến thức cơ bản về lập trình thi đấu. Đây lại là một biến thể nhàm chán khác của nó.

Bạn có hai số nguyên $A$ và $B$. Bạn muốn làm cho chúng bằng nhau. Để làm điều đó, bạn có thể thực hiện một số bước, trong đó mỗi bước là một trong các thao tác sau:

  • $A$+= $A$
  • $A$+= $B$
  • $B$+= $A$
  • $B$+= $B$

Đáng tiếc, $A+B$ là một bài toán khó đối với chúng tôi, nên bạn chỉ được phép thực hiện nhiều nhất 5000 bước.

Dữ liệu vào

Cho hai số nguyên $A, B$. ($1 \le A, B \le 10^{18}$).

Dữ liệu ra

Trên dòng đầu tiên, in ra một số nguyên $n$ ($0 \le n \le 5000$) biểu thị số bước.

Trong $n$ dòng tiếp theo, in ra một trong các chuỗi sau để biểu thị thao tác bạn muốn thực hiện: "A+=A", "A+=B", "B+=A" hoặc "B+=B".

Bất kỳ dãy bước nào tạo ra kết quả mong muốn đều được chấm là đúng.

Ví dụ

Dữ liệu vào 1

2 3

Dữ liệu ra 1

4
B+=B
B+=A
A+=A
A+=A

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.