c049. 00356 - Square Pegs And Round Holes
Tags :
Accepted rate: 336人/ 395人 ( 85%) [非即時]
評分方式:
Tolerant

最近更新 : 2015-08-28 15:49

Content

在一個邊長為2n的正方形棋盤中央畫一個直徑為2n-1的圓,以下的圖為n=3

寫一個程式判斷有多少個格子是一部份在圓中,以及有多少個格子是完全被包含在圓當中。

Input

輸入包含好幾行測試資料,每行有一個正整數n(n<=150)

Output

對每一行輸入資料,輸出2行,第一行為部分被包含在圓中的個子數。第二行為完全被包含在圓中的格子數。對每一個數入資料,輸出資料間要空一行。請參考Sample output

Sample Input #1
3
4
Sample Output #1
In the case n = 3, 20 cells contain segments of the circle.
There are 12 cells completely contained in the circle.

In the case n = 4, 28 cells contain segments of the circle.
There are 24 cells completely contained in the circle.
測資資訊:
記憶體限制: 512 MB
公開 測資點#0 (100%): 1.0s , <1K
Hint :

* 中文翻譯:Lucky 貓

Tags:
出處:
UVa 356

Status Forum 排行

ID User Problem Subject Hit Post Date
18974 froghackervi ... (Cow Frog) c049
1752 2019-08-20 15:52