結果

問題 No.313 π
ユーザー fmhrfmhr
提出日時 2015-12-06 23:27:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 587 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 8,520 KB
最終ジャッジ日時 2023-10-12 17:48:08
合計ジャッジ時間 2,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,380 KB
testcase_01 RE -
testcase_02 AC 16 ms
8,372 KB
testcase_03 AC 17 ms
8,420 KB
testcase_04 AC 17 ms
8,456 KB
testcase_05 AC 17 ms
8,396 KB
testcase_06 AC 18 ms
8,392 KB
testcase_07 AC 18 ms
8,352 KB
testcase_08 AC 17 ms
8,368 KB
testcase_09 AC 17 ms
8,368 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_pi(n):
	q, r, t, k, m, x = 1, 0, 1, 1, 3, 3
	for j in range(n+1):
		if 4 * q + r - t < m * t:
			yield m
			q, r, t, k, m, x = 10*q, 10*(r-m*t), t, k, (10*(3*q+r))//t - 10*m, x
		else:
			q, r, t, k, m, x = q*k, (2*q+r)*x, t*x, k+1, (q*(7*k+2)+r*x)//(t*x), x+2


def main():
	s = input()
	if s[0] != '3':
		print(s[0],'3')
		return
	if s[1] != '.':
		print(s[1],'.')
		return
	digits = make_pi(len(s))
	pi_list = []
	my_array = []
	for i in make_pi():
		my_array.append(str(i))
	for i in range(len(s)):
		if s[2+i]!=my_array[1+i]:
			print(s[2+i],my_array[1+i])
			return
main()
0