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

5341번 - Pyramids 다국어

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

문제

A pyramid of blocks is constructed by first building a base layer of n blocks and then adding n-1 blocks to the next layer. This process is repeated until the top layer only has one block.

You must calculate the number of blocks needed to construct a pyramid given the size of the base. For example, a pyramid that has a base of size 4 will need a total of 10 blocks.

입력

The input will be a sequence of integers, one per line. The end of input will be signaled by the integer 0, and does not represent the base of a pyramid. All integers, other than the last (zero), are positive.

출력

For each positive integer print the total number of blocks needed to build the pyramid with the specified base.

제한

예제 입력 1

4
6
0

예제 출력 1

10
21

힌트

출처

School > PLU High School Programming Contest > PLU 2013 > Novice 5번

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

출처

대학교 대회

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

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