結果
問題 |
No.781 円周上の格子点の数え上げ
|
ユーザー |
![]() |
提出日時 | 2025-03-20 20:53:10 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,049 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 154,888 KB |
最終ジャッジ日時 | 2025-03-20 20:53:28 |
合計ジャッジ時間 | 8,663 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 TLE * 1 |
ソースコード
def sieve(n): spf = list(range(n + 1)) for i in range(2, int(n**0.5) + 1): if spf[i] == i: # i is a prime for j in range(i * i, n + 1, i): if spf[j] == j: spf[j] = i return spf def main(): import sys X, Y = map(int, sys.stdin.readline().split()) max_f = 0 spf = sieve(Y) for R in range(X, Y + 1): current_R = R valid = True product = 1 p_count = {} while current_R > 1: p = spf[current_R] count = 0 while current_R % p == 0: count += 1 current_R //= p if p % 4 == 3: if count % 2 != 0: valid = False break elif p % 4 == 1: product *= (count + 1) if valid: current_f = 4 * product else: current_f = 0 if current_f > max_f: max_f = current_f print(max_f) if __name__ == '__main__': main()