結果

問題 No.1593 Perfect Distance
ユーザー OohMajestic!
提出日時 2021-07-10 08:55:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 61,056 KB
最終ジャッジ日時 2024-07-02 01:42:39
合計ジャッジ時間 1,859 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N = int(input())
radius = N ** 2

primal = [0, 1, 129, 4, 132, 9, 137, 16, 144, 17, 145, 25, 153, 33, 161, 36, 164, 169, 41,
 49, 177, 185, 57, 64, 193, 65, 196, 68, 73, 201, 81, 209, 217, 89, 225, 97, 100,
 228, 249, 105, 233, 113, 241, 121]

count = 0
for i in range(1, N):
    target = radius - i ** 2
    if ((target % 256) in primal):
        if (math.sqrt(target).is_integer()):
            count += 1

print(count)
0