結果

問題 No.800 四平方定理
ユーザー TakoKurageTakoKurage
提出日時 2019-03-17 22:27:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 81,964 KB
最終ジャッジ日時 2023-09-22 07:54:51
合計ジャッジ時間 6,283 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
81,572 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 210 ms
77,136 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 296 ms
77,000 KB
testcase_07 WA -
testcase_08 AC 98 ms
76,480 KB
testcase_09 AC 259 ms
77,056 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

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