結果

問題 No.2177 Recurring ab
ユーザー MasKoaTSMasKoaTS
提出日時 2022-11-30 16:18:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 1,077 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 89,344 KB
最終ジャッジ日時 2024-04-16 14:40:12
合計ジャッジ時間 4,391 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
86,912 KB
testcase_01 AC 142 ms
86,400 KB
testcase_02 AC 153 ms
88,960 KB
testcase_03 AC 150 ms
89,344 KB
testcase_04 AC 152 ms
89,216 KB
testcase_05 AC 144 ms
87,040 KB
testcase_06 AC 152 ms
88,832 KB
testcase_07 AC 151 ms
89,216 KB
testcase_08 AC 150 ms
88,960 KB
testcase_09 AC 150 ms
89,216 KB
testcase_10 AC 154 ms
89,344 KB
testcase_11 AC 156 ms
89,216 KB
testcase_12 AC 147 ms
86,656 KB
testcase_13 AC 148 ms
86,912 KB
testcase_14 AC 152 ms
89,216 KB
testcase_15 AC 154 ms
89,216 KB
testcase_16 AC 151 ms
89,216 KB
testcase_17 AC 149 ms
87,552 KB
testcase_18 AC 147 ms
86,912 KB
testcase_19 AC 153 ms
89,216 KB
testcase_20 AC 155 ms
89,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0];	dy = [0, 1, 0, -1]
#di = coll.defaultdict(int)

def check(p):
	return (p * p - n * a * p - (n * b + 1) < 0)

"""
Main Code
"""

n = getN()

ans = 0
for a, b in iter.permutations([*range(10)], 2):
	p_init = max(a, b) + 1

	if not(check(p_init)):
		continue
	ok = p_init
	ng = 10 ** 9 + 1
	while(ng - ok > 1):
		p = (ok + ng) >> 1
		if(check(p)):
			ok = p
		else:
			ng = p
	ans += ok - p_init + 1

print(ans)
0