結果

問題 No.152 貯金箱の消失
ユーザー mkawa2mkawa2
提出日時 2020-01-02 08:50:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 843 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 17,824 KB
最終ジャッジ日時 2024-05-02 06:13:01
合計ジャッジ時間 8,445 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 32 ms
10,624 KB
testcase_02 AC 26 ms
10,624 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 124 ms
10,752 KB
testcase_05 AC 127 ms
10,624 KB
testcase_06 AC 209 ms
10,752 KB
testcase_07 AC 1,184 ms
10,752 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def gcd(a,b):
    while b>0:a,b=b,a%b
    return a

def main():
    md=10**6+3
    l=II()
    ans=0
    for m in range(1,l):
        for n in range(1,m):
            a=m**2-n**2
            b=2*m*n
            c=m**2+n**2
            if 4*(a+b+c)>l:break
            if gcd(gcd(a,b),c)>1:continue
            ans+=1
    print(ans%md)

main()
0