아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Jaggie Spheres

시간 제한8초메모리 제한512 MB

요약
원점에서 거리가 sqrt(n)보다 작은 모든 점을 포함하면서 꼭짓점이 정수 좌표인 단위 정육면체들의 합집합 중 가장 작은 J(n)의 면의 개수를 구한다.
난이도

보통10점 중 7점

유형
기하, 수학, 구현
정답자
아직 제출이 없습니다

문제

Let J(n) be a three-dimensional body that

  • is a union of unit cubes whose all vertices lie on integer coordinates,
  • contains all points that are closer than the distance of √n to the origin, and
  • is the smallest of all such bodies.

The figure below shows how J(1), J(2), and J(3) look.

Figure 1: Jaggie Spheres for n = 1, 2, 3

Your task is to calculate how many faces J(n) have. Here, we define two square belong to the same face if they are parallel and share an edge, but don’t if they share just a vertex.

입력

The input consists of multiple data sets, each of which comes with a single line containing an integer n (1 ≤ n ≤ 1000000). The end of input is indicated by n = 0.

출력

For each data set, print the number of faces J(n) have.

예제1

  1. 예제 1

    입력
    1
    2
    3
    4
    0
    
    예상 출력
    6
    30
    30
    6