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

26011번 - Alternative Architecture 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB123644463.768%

문제

In his free time, Thomas greatly enjoys working on the extensive Lego project that he has built in his attic, adding house after house to his miniature city. However, he has become a bit bored with the completely rectangular layout that is enforced by the little studs of the huge base plate that his city is built on.

After an exchange with some other Lego creators he came across a technique that will allow him to place his buildings at different angles. Each building rests on a rectangular ground plate, to the underside of which he attaches four round 1ドル\times 1$-plates in the corners. These 1ドル\times 1$-plates are then placed on four studs of the base plate, like in Figure A.1.

Figure A.1: Placing a 6ドル\times6$ plate diagonally.

If the ground plate of the building is $a\times b$ studs, what is the number of orientations it can be placed in using this technique, so that all the corner plates exactly fit on studs of the base plate?

Figure A.2: Illustration of the first sample case. There are many ways of placing a 6ドル \times 11$ plate, but only 6ドル$ distinct orientations.

입력

The input consists of:

  • One line with two integers $a$ and $b$ (2ドル \le a,b \le 10^6$), the dimensions of the ground plate the building is resting on.

출력

Output one integer, the number of different orientations the ground plate can be placed in.

제한

예제 입력 1

6 11

예제 출력 1

6

예제 입력 2

26 26

예제 출력 2

5

예제 입력 3

123 456

예제 출력 3

2

예제 입력 4

3 3

예제 출력 4

1

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2022 A번

  • 문제를 만든 사람: Paul Wild
(追記) (追記ここまで)

출처

대학교 대회

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

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