#P9859. [CCC 2008 S2] Pennies in the Ring
[CCC 2008 S2] Pennies in the Ring
题目描述
The game “Pennies in the Ring” is often played by bored computer programmers who have gotten tired of playing solitare. The objective is to see how many pennies can be put into a circle. The circle is drawn on a grid, with its center at the coordinate . A single penny is placed on every integer grid coordinate (e.g., ,, etc.) that lies within or on the circle. It’s not a very exciting game, but it’s very good for wasting time. Your goal is to calculate how many pennies are needed for a circle with a given radius.
输入格式
The input is a sequence of positive integer values, one per line, where each integer is the radius of a circle. You can assume the radius will be less than or equal to . The last integer will be indicated by . You may assume that the grid is large enough for two pennies to be on adjacent integer coordinates and not touch.
输出格式
You are to output, each on its own line, the number of pennies needed for each circle. You do not need to output for the last . You may assume that the number of possible pennies is less than billion (which is only million dollars: computer scientists have lots of money).
题目大意
你在玩一个游戏,它给了你一个圆的半径 半径 。假设圆的圆心是在一个半径 半径的图中的正中间,请你求出,有多少个点是包含在圆内的(当一个点在圆的边上时也算)。
本题有多组数据,当读入到 时视为程序结束。
2
3
4
0
13
29
49