結果

問題 No.1593 Perfect Distance
ユーザー da_abda_ab
提出日時 2021-07-09 22:59:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 8,012 KB
最終ジャッジ日時 2023-09-14 10:31:00
合計ジャッジ時間 1,868 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,960 KB
testcase_01 AC 16 ms
7,900 KB
testcase_02 AC 17 ms
7,900 KB
testcase_03 AC 16 ms
7,920 KB
testcase_04 AC 16 ms
7,900 KB
testcase_05 AC 16 ms
7,960 KB
testcase_06 AC 16 ms
7,932 KB
testcase_07 AC 17 ms
7,916 KB
testcase_08 AC 17 ms
7,912 KB
testcase_09 AC 20 ms
7,980 KB
testcase_10 AC 29 ms
7,800 KB
testcase_11 AC 37 ms
7,940 KB
testcase_12 AC 51 ms
7,956 KB
testcase_13 AC 54 ms
7,948 KB
testcase_14 AC 59 ms
8,012 KB
testcase_15 AC 82 ms
7,956 KB
testcase_16 AC 108 ms
7,832 KB
testcase_17 AC 16 ms
7,956 KB
testcase_18 AC 17 ms
7,856 KB
testcase_19 AC 17 ms
7,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#1593 Perfect Distance

from math import sqrt

n=int(input())

n2=pow(n,2)
cnt=0
for i in range(1,int(sqrt(n2/2))+1):
    kCand=n2-pow(i,2)
    if pow(round(sqrt(kCand)),2)==kCand:
        if pow(i,2)!=kCand:
            cnt+=2
        else:
            cnt+=1
print(cnt)

0