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

3798번 - Beer Land 다국어

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

문제

King ACM 2002 received some clear ground and some money through inheritance. Terms of the will and testament require the heir to build n towns. He was also required to build the least quantity of two-way roads between the towns such that one could travel from any town to any other town even if one road was closed under repair. Carefully, all such roads must be constructed as geometrically straight lines. Further, the condition that a traveller be able to get from one town to another (even with one road closed) needs to be satisfied by traversing the roads as straight lines in their entirety --- not stopping partway along one road to switch to another.

Because of rich soil in those lands, the future inhabitants of the place have decided to produce beer. On the crossroads (a crossroad is merey the intersection of two or more roads) the king plans to build beer stands (one stand per a crossroad). So, if three or four (or twenty) roads intersect in a single point, there’s still only one appropriate place for a beer stand. The King must choose locations for the towns and the roads. You need to advise him so that he builds as many beer stands as possible.

입력

The first line of input contains the number of test cases. For each case there is a line containing a single integer n (1 ≤ n ≤ 32767). This represents the number of towns to be built.

출력

For each n, print a line containing the maximum number of beer stands possible to build.

제한

예제 입력 1

3
3
4
5

예제 출력 1

0
1
5

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2002 B번

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

출처

대학교 대회

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

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