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

18581번 - Cake Distribution 스페셜 저지다국어

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

문제

You are about to have a birthday and you would like to prepare a birthday cake that weighs anywhere between 1 and 1018 grams inclusive. You know that there will be A, B or C guests at the party. You would like to cut this cake into pieces such that:

  • The weight of each piece is a positive integer number of grams.
  • No matter how many guests arrive, the pieces can be distributed between the guests in such a way that each guest gets the same amount of cake. Note that some guests might get more than one piece.

You don’t want to spend too much time cutting the cake, so you would like to have at most 5,000 pieces. Let’s do it!

입력

The only line of input contains the 3 numbers A, B, C, all positive integers not more than 1000.

출력

On the first line, output one number K, the number of pieces. On each of the next K lines, output a description of each piece, consisting of 4 numbers, wi, ai, bi, ci, where wi is the weight of the piece in grams and ai, bi, ci are indices of the person who will get this piece if A, B, or C guests arrive, respectively. The indices should satisfy 1 ≤ ai ≤ A, 1 ≤ bi ≤ B, 1 ≤ ci ≤ C. The sum of all wis must be less than or equal to 1018.

제한

예제 입력 1

1 2 3

예제 출력 1

4
2 1 1 1
1 1 1 2
1 1 2 2
2 1 2 3

힌트

출처

Contest > Waterloo's local Programming Contests > 29 September, 2019 A번

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

출처

대학교 대회

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

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