結果

問題 No.152 貯金箱の消失
ユーザー roiti46roiti46
提出日時 2015-02-16 01:57:43
言語 Python2
(2.7.18)
結果
AC  
実行時間 315 ms / 5,000 ms
コード長 295 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 6,524 KB
実行使用メモリ 6,452 KB
最終ジャッジ日時 2023-09-06 01:34:22
合計ジャッジ時間 2,140 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,196 KB
testcase_01 AC 11 ms
6,268 KB
testcase_02 AC 11 ms
6,428 KB
testcase_03 AC 11 ms
6,240 KB
testcase_04 AC 15 ms
6,180 KB
testcase_05 AC 15 ms
6,308 KB
testcase_06 AC 18 ms
6,372 KB
testcase_07 AC 56 ms
6,232 KB
testcase_08 AC 311 ms
6,228 KB
testcase_09 AC 315 ms
6,344 KB
testcase_10 AC 245 ms
6,316 KB
testcase_11 AC 142 ms
6,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a,b):
    return a if b == 0 else gcd(b,a%b)
    
N = int(raw_input())
ans = 0
for m in xrange(1,int((N/6)**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