結果

問題 No.152 貯金箱の消失
ユーザー mkawa2mkawa2
提出日時 2019-12-24 18:15:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 456 ms / 5,000 ms
コード長 843 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 81,932 KB
実行使用メモリ 75,768 KB
最終ジャッジ日時 2023-10-22 06:10:27
合計ジャッジ時間 3,519 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,532 KB
testcase_01 AC 50 ms
63,820 KB
testcase_02 AC 44 ms
55,588 KB
testcase_03 AC 51 ms
63,824 KB
testcase_04 AC 68 ms
75,728 KB
testcase_05 AC 69 ms
75,728 KB
testcase_06 AC 77 ms
75,732 KB
testcase_07 AC 125 ms
75,744 KB
testcase_08 AC 443 ms
75,760 KB
testcase_09 AC 456 ms
75,768 KB
testcase_10 AC 366 ms
75,764 KB
testcase_11 AC 232 ms
75,760 KB
権限があれば一括ダウンロードができます

ソースコード

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