結果
問題 |
No.152 貯金箱の消失
|
ユーザー |
![]() |
提出日時 | 2020-01-02 08:52:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 428 ms / 5,000 ms |
コード長 | 843 bytes |
コンパイル時間 | 360 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 76,520 KB |
最終ジャッジ日時 | 2024-11-22 17:41:41 |
合計ジャッジ時間 | 2,831 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
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()