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

9958번 - All Squares 다국어

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

문제

Geometrically, any square has a unique, well-defined centre point. On a grid this is only true if the sides of the square span an odd number of points. Since any odd number can be written in the form 2k+1, we can characterise any such square by specifying k, i.e. we can say that a square whose sides are of length 2k+1 has size k. Now define a pattern of squares as follows.

  1. The largest square is of size k (i.e. sides are of length 2k+1) and is centred in a grid of size 1024 (i.e. the grid sides are of length 2049).
  2. The smallest permissible square is of size 1 and the largest is of size 512, thus 1 ≤ k ≤ 512.
  3. All squares of size k > 1 have a square of size k / 2 centred on each of their 4 corners. (Integer division, thus 9 / 2 = 4).
  4. The top left corner of the grid has coordinates (0,0).

Hence, given a value of k, we can draw a unique pattern of squares according to the above rules, e.g., if k is 15, then the following pattern would be produced.

Obviously, any point in the grid will be surrounded by zero or more squares. (If the point is on the border of a square, it is considered to be surrounded by that square).

Write a program that will read in a value of k and the coordinates of a point, and will determine how many squares surround the point.

입력

Input will consist of a series of lines containing 3 integers (k and the coordinates of the point) terminated by a line consisting of three zeroes (0 0 0).

출력

Output will consist of a series of lines, one for each line of the input. Each line will consist of the number of squares surrounding the specified point.

제한

예제 입력 1

500 113 941
0 0 0

예제 출력 1

5

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2007 L번

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

출처

대학교 대회

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

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