結果

問題 No.152 貯金箱の消失
ユーザー nbisconbisco
提出日時 2017-01-29 09:46:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 685 ms / 5,000 ms
コード長 341 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 9,864 KB
最終ジャッジ日時 2023-10-11 02:49:37
合計ジャッジ時間 3,549 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,864 KB
testcase_01 AC 29 ms
9,664 KB
testcase_02 AC 29 ms
9,656 KB
testcase_03 AC 30 ms
9,652 KB
testcase_04 AC 37 ms
9,800 KB
testcase_05 AC 38 ms
9,780 KB
testcase_06 AC 44 ms
9,656 KB
testcase_07 AC 128 ms
9,796 KB
testcase_08 AC 656 ms
9,672 KB
testcase_09 AC 685 ms
9,636 KB
testcase_10 AC 533 ms
9,792 KB
testcase_11 AC 312 ms
9,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import fractions
L = int(input())
mod = 1000003
count = 0
for x in range(2, int(math.sqrt(L//4))+1):
    for y in range(1, x):
        if (x-y) % 2 == 0:
            continue
        a = x**2 - y**2
        b = 2*x*y
        c = x**2 + y**2
        if a+b+c <= L//4 and math.gcd(x,y) == 1:
            count += 1
print(count%mod)
0