結果

問題 No.152 貯金箱の消失
ユーザー roiti46roiti46
提出日時 2015-02-16 01:53:08
言語 Python2
(2.7.18)
結果
AC  
実行時間 248 ms / 5,000 ms
コード長 306 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 6,752 KB
実行使用メモリ 6,380 KB
最終ジャッジ日時 2023-09-06 01:34:04
合計ジャッジ時間 1,784 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,224 KB
testcase_01 AC 12 ms
6,380 KB
testcase_02 AC 11 ms
6,280 KB
testcase_03 AC 12 ms
6,356 KB
testcase_04 AC 15 ms
6,240 KB
testcase_05 AC 15 ms
6,200 KB
testcase_06 AC 17 ms
6,356 KB
testcase_07 AC 48 ms
6,360 KB
testcase_08 AC 246 ms
6,360 KB
testcase_09 AC 248 ms
6,244 KB
testcase_10 AC 195 ms
6,340 KB
testcase_11 AC 114 ms
6,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a,b):
    while b: a,b = b,a%b
    return a
    
N = int(raw_input())
ans = 0
for m in xrange(1,int((N/2)**0.5)+1):
    for n in xrange(1,m):
        if (m-n)%2 != 1: continue
        s = (m*m+n*n) + (2*m*n) + (m*m-n*n)
        if 4*s > N: break
        if gcd(m,n) == 1: ans += 1
print ans%1000003
0