結果

問題 No.3156 Count That Day's N
ユーザー Iroha_3856
提出日時 2025-05-23 19:12:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 451 ms / 3,000 ms
コード長 359 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 242,572 KB
最終ジャッジ日時 2025-05-23 19:13:16
合計ジャッジ時間 11,101 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt

def issq(n):
	t = isqrt(n)
	return n > 0 and t * t == n
	
K, N = map(int, input().split())
F = []
S = []
x = 1
while x**4 <= N:
	F.append(x**4)
	x += 1
y = 1
while y**6 <= N:
	S.append(y**6)
	y += 1
ans = 0
T = set()
for f in F:
	for s in S:
		if f + s <= N:
			T.add(f+s)
for t in T:
	if t%K == 0 and issq(t//K):
		ans += 1
print(ans)
0