結果

問題 No.800 四平方定理
ユーザー TakoKurage
提出日時 2019-03-17 22:27:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 83,264 KB
最終ジャッジ日時 2024-07-08 00:22:15
合計ジャッジ時間 5,154 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 5 WA * 5 TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = [int(i) for i in input().split()]

count = 0
for x in range(1, N + 1):
    for y in range(x, N + 1):
        for z in range(y, N + 1):
            t = x * x + y * y + z * z - D
            if t < 0:
                continue
            if t > N * N:
                break
            w = int(t ** 0.5)
            if t == w * w:
                num = len(set([x, y, z])) - 1
                count += [1, 3, 6][num]
print(count)

0