Logo
(追記) (追記ここまで)

24850번 - Octopus Game 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB32101032.258%

문제

The tournament of "Octopus Game" is held in some country.

This round the participants will deal with math puzzle. Each player has two cards, initially there are integers $a_0$ and $b_0$ at the cards, respectively.

Players make actions with their cards. Let the integers on player's cards be $a$ and $b$. The player first chooses an integer $k,ドル and then performs one of the following operations:

  1. replace the integer on the first card with $a + kb$;
  2. replace the integer on the second card with $b + ka$.

While playing, the absolute value of an integer written on a card must not exceed 10ドル^{18},ドル otherwise something bad might happen. Those players are winning the round, who get 0ドル$ written on one of the cards, after performing at most 50ドル$ actions.

You are going to play the game, and of course you would like to win!

입력

The only line of input contains two integers $a_0$ and $b_0$ --- the initial integers written on the cards ($-10^{18} \le a_0, b_0 \le 10^{18}$).

출력

The first line must contain $n$ --- the number of actions that the player is willing to perform to get 0 on one of the cards (0ドル \le n \le 50$). Note that you need not minimize the number of actions, but it must not exceed 50ドル$.

The following $n$ lines must contain two space separated integers each: $t_i$ and $k_i$ --- the type of the respective action and the chosen integer $k$.

If there are multiple valid solutions, it is allowed to output any of them, but note that during the game the integers on the cards must not exceed 10ドル^{18}$ by their absolute values.

제한

예제 입력 1

-3 9

예제 출력 1

1
2 3

예제 입력 2

-27 57

예제 출력 2

2
2 2
1 9

예제 입력 3

56 15

예제 출력 3

6
1 -2
1 -1
2 -2
1 1
2 2
1 -4

노트

The first test requires just one action: add three times integer on the first card to the integer on the second card.

The second test: after the first action there are integers $-27$ and 3ドル$ on the cards, respectively, after the second action the integers are 0ドル$ and 3ドル$.

The third test: the integers on the cards are in turn: 56ドル$ and 15ドル,ドル 26ドル$ and 15ドル,ドル 11ドル$ and 15ドル,ドル 11ドル$ and $-7,ドル 4ドル$ and $-7,ドル 4ドル$ and 1ドル,ドル 0ドル$ and 1ドル$.

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2021 H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /