結果

問題 No.313 π
ユーザー fmhrfmhr
提出日時 2015-12-06 23:29:06
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 589 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 79,324 KB
最終ジャッジ日時 2023-10-12 17:49:01
合計ジャッジ時間 6,781 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,632 KB
testcase_01 RE -
testcase_02 AC 74 ms
71,668 KB
testcase_03 AC 74 ms
71,440 KB
testcase_04 AC 73 ms
71,572 KB
testcase_05 AC 74 ms
71,716 KB
testcase_06 AC 74 ms
71,764 KB
testcase_07 AC 75 ms
71,544 KB
testcase_08 AC 72 ms
71,440 KB
testcase_09 AC 76 ms
71,728 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+100):
		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