結果

問題 No.152 貯金箱の消失
ユーザー nebukuro09nebukuro09
提出日時 2016-10-31 01:54:22
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 265 ms / 5,000 ms
コード長 285 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 77,708 KB
実行使用メモリ 83,688 KB
最終ジャッジ日時 2023-08-16 11:29:20
合計ジャッジ時間 4,013 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
82,496 KB
testcase_01 AC 141 ms
82,576 KB
testcase_02 AC 141 ms
82,564 KB
testcase_03 AC 142 ms
82,596 KB
testcase_04 AC 147 ms
82,832 KB
testcase_05 AC 152 ms
82,764 KB
testcase_06 AC 153 ms
83,236 KB
testcase_07 AC 169 ms
83,552 KB
testcase_08 AC 262 ms
83,564 KB
testcase_09 AC 265 ms
83,688 KB
testcase_10 AC 238 ms
83,472 KB
testcase_11 AC 198 ms
83,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from fractions import gcd
L = input()/4
R =  int(math.sqrt(L))+1
ans = 0

for n in xrange(1, R):
    for m in xrange(n+1, R, 2):
        if gcd(m, n) != 1:
            continue
        a, b, c = m*m-n*n, 2*m*n, m*m+n*n
        if a+b+c <= L:
            ans += 1
print ans
0