結果

問題 No.152 貯金箱の消失
ユーザー roiti46roiti46
提出日時 2015-02-16 01:58:48
言語 Python2
(2.7.18)
結果
AC  
実行時間 237 ms / 5,000 ms
コード長 294 bytes
コンパイル時間 51 ms
コンパイル使用メモリ 6,720 KB
実行使用メモリ 6,460 KB
最終ジャッジ日時 2023-09-06 01:34:24
合計ジャッジ時間 1,710 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,356 KB
testcase_01 AC 12 ms
6,216 KB
testcase_02 AC 11 ms
6,436 KB
testcase_03 AC 12 ms
6,356 KB
testcase_04 AC 14 ms
6,360 KB
testcase_05 AC 14 ms
6,296 KB
testcase_06 AC 16 ms
6,244 KB
testcase_07 AC 46 ms
6,216 KB
testcase_08 AC 234 ms
6,276 KB
testcase_09 AC 237 ms
6,232 KB
testcase_10 AC 185 ms
6,460 KB
testcase_11 AC 109 ms
6,232 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/8)**0.5)+1):
    for n in xrange(1,m):
        if (m-n)%2 != 1: continue
        if 4*((m*m+n*n) + (2*m*n) + (m*m-n*n)) > N: break
        if gcd(m,n) == 1: ans += 1
print ans%1000003
0