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

15226번 - House of Cards 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB23912511453.774%

문제

Brian and Susan are old friends, and they always dare each other to do reckless things. Recently Brian had the audacity to take the bottom right exit out of their annual maze race, instead of the usual top left one. In order to trump this, Susan needs to think big. She will build a house of cards so big that, should it topple over, the entire country would be buried by cards. It’s going to be huge!

The house will have a triangular shape. The illustration to the right shows a house of height 6, and Figure D.1 shows a schematic figure of a house of height 5.

For aesthetic reasons, the cards used to build the tower should feature each of the four suits (clubs, diamonds, hearts, spades) equally often. Depending on the height of the tower, this may or may not be possible. Given a lower bound h0 on the height of the tower, what is the smallest possible height h ≥ h0 such that it is possible to build the tower?

Figure D.1: A house of height 5 uses 40 cards.

입력

A single integer 1 ≤ h0 ≤ 101000, the minimum height of the tower.

출력

An integer, the smallest h ≥ h0 such that it is possible to build a tower of height h.

제한

예제 입력 1

2

예제 출력 1

5

예제 입력 2

42

예제 출력 2

45

힌트

출처

Contest > KTH Challenge > KTH Challenge 2017 D번

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

출처

대학교 대회

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

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