c049. 00356 - Square Pegs And Round Holes
標籤 :
通過比率 : 310人/359人 ( 86% ) [非即時]
評分方式:
Tolerant

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

內容

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

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

輸入說明

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

輸出說明

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

範例輸入 #1
3
4
範例輸出 #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
提示 :

* 中文翻譯:Lucky 貓

標籤:
出處:
UVa356

本題狀況 本題討論 排行

編號 身分 題目 主題 人氣 發表日期
18974 froghackervi ... (Cow Frog) c049
1264 2019-08-20 15:52