結果

問題 No.2177 Recurring ab
ユーザー MasKoaTSMasKoaTS
提出日時 2022-11-13 23:11:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 1,187 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 76,160 KB
最終ジャッジ日時 2023-10-13 07:25:23
合計ジャッジ時間 4,395 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,044 KB
testcase_01 AC 70 ms
71,276 KB
testcase_02 AC 77 ms
76,068 KB
testcase_03 AC 78 ms
76,088 KB
testcase_04 AC 76 ms
75,968 KB
testcase_05 AC 76 ms
75,984 KB
testcase_06 AC 76 ms
75,968 KB
testcase_07 AC 77 ms
75,812 KB
testcase_08 AC 76 ms
76,128 KB
testcase_09 AC 77 ms
75,972 KB
testcase_10 AC 77 ms
76,024 KB
testcase_11 AC 78 ms
76,148 KB
testcase_12 AC 76 ms
75,848 KB
testcase_13 AC 78 ms
75,836 KB
testcase_14 AC 79 ms
76,124 KB
testcase_15 AC 79 ms
76,064 KB
testcase_16 AC 79 ms
75,784 KB
testcase_17 AC 75 ms
76,036 KB
testcase_18 AC 77 ms
75,644 KB
testcase_19 AC 77 ms
76,156 KB
testcase_20 AC 78 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import permutations
input = sys.stdin.readline

n = int(input())

def check(p, a, b):
	return (p ** 2 < n * (p * a + b) + 1)

ans = 0
for a, b in permutations([*range(10)], 2):
	min_p = max(a, b) + 1
	if not(check(min_p, a, b)):
		continue
	ok = min_p
	ng = 10 ** 9 + 1
	while(ng - ok > 1):
		p = (ok + ng) >> 1
		if(check(p, a, b)):
			ok = p
		else:
			ng = p
	ans += ok - min_p + 1

print(ans)
0