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

19736번 - Secret Code 다국어

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

문제

Bogdan is a fan of riddles and puzzles. He asked his friend Anton to come up with a secret code that Bogdan would then decode.

Anton has decided to use a non-negative integer without extra leading zeroes as a secret code. The code must satisfy the following condition. If you consider any three consecutive digits of it as a three-digit integer, it is divisible by three.

Anton has given all digits of his secret code, as well as possibly some other digits, to Bodgan. He claims that the maximal number satisfying the above condition that can be created out of these digits is the secret code.

Help Bogdan to find out what is the secret code.

입력

Input contains 10 integers: $c_0, \ldots, c_9,ドル here $c_i$ is the number of digits $i$ that Anton has given to Bogdan (0ドル \le c_i \le 100,000円$). The sum of $c_i$ is strictly positive and doesn't exceed 100ドル,000円$.

출력

Output the maximal integer that can be created out of these digits. It must satisfy the condition that an integer formed by any three consecutive digits is divisible by three. It is not required to use all of the given digits. Note that any one-digit or two-digit number automatically satisfies the above condition, because it doesn't have three consecutive digits. The answer must not contain extra leading zeroes: the first digit can be 0ドル$ only if the number is zero, in this case it must be the only digit.

제한

예제 입력 1

1 2 3 0 0 0 0 0 0 0

예제 출력 1

21021

예제 입력 2

1 1 1 1 1 1 1 1 1 1

예제 출력 2

9876543210

힌트

출처

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

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

출처

대학교 대회

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

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