結果

問題 No.800 四平方定理
ユーザー tomarint2tomarint2
提出日時 2019-03-17 21:36:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 503 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 76,760 KB
最終ジャッジ日時 2023-09-22 04:12:24
合計ジャッジ時間 7,726 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
76,352 KB
testcase_01 AC 386 ms
76,532 KB
testcase_02 AC 266 ms
76,168 KB
testcase_03 AC 279 ms
76,388 KB
testcase_04 AC 238 ms
76,644 KB
testcase_05 AC 475 ms
76,604 KB
testcase_06 AC 490 ms
76,300 KB
testcase_07 AC 412 ms
76,760 KB
testcase_08 AC 142 ms
75,992 KB
testcase_09 AC 432 ms
75,852 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 #

def solve():
    N,D=map(int,input().split())
    ans=0
    sq = set()
    for i in range(1,N+1):
        sq.add(i * i)

    for x in range(1,N+1):
        x2 = x * x
        for y in range(1,N+1):
            y2 = y * y
            for z in range(1,N+1):
                z2 = z * z
                w2 = x2 + y2 + z2 - D
                if w2 < 1:
                    continue
                if w2 in sq:
                    ans += 1
                    #print(x,y,z,w2)
    return ans

print(solve())
0