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

6030번 - Scavenger Hunt 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB131496891175.602%

문제

Farmer John has scattered treats for Bessie at special places in the pasture. Since everyone knows that smart cows make tasty milk, FJ has placed the treats at locations that require Bessie to think. He has given her two numbers, P and Q (1 <= P <= 6,000; 1 <= Q <= 6,000), and she has to check every point in the pasture whose x-coordinate is a factor of P and whose y-coordinate is a factor of Q to find her treat.

Suppose FJ gives Bessie P = 24 and Q = 2. Here are all of their respective factors:

  • P = 24 => 1, 2, 3, 4, 6, 8, 12, 24
  • Q = 2 => 1, 2

Bessie would thus check grid locations: (1, 1), (1, 2), (2, 1), (2, 2), (3, 1)...

Help Bessie by printing all of the points she ought to check.

입력

  • Line 1: Two space separated integers: P and Q

출력

  • Lines 1..?: A complete list of unique pairs of space-separated integers sorted by the first number and, if tied, the second number: a factor of P followed by a factor of Q

제한

예제 입력 1

24 2

예제 출력 1

1 1
1 2
2 1
2 2
3 1
3 2
4 1
4 2
6 1
6 2
8 1
8 2
12 1
12 2
24 1
24 2

힌트

출처

Olympiad > USA Computing Olympiad > 2009-2010 Season > USACO February 2010 Contest > Bronze 1번

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

출처

대학교 대회

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

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