結果
| 問題 | No.152 貯金箱の消失 |
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:21:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 152 ms / 5,000 ms |
| コード長 | 728 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 76,012 KB |
| 最終ジャッジ日時 | 2025-06-12 19:22:12 |
| 合計ジャッジ時間 | 1,523 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
import math
import sys
def main():
L = int(sys.stdin.readline())
max_sum_abc = L // 4
if max_sum_abc < 12: # 最小的原始勾股数对sum_abc是12,当L < 48时无法满足
print(0)
return
count = 0
max_m = int(math.sqrt(max_sum_abc)) + 2 # 确保覆盖所有可能的m
for m in range(2, max_m + 1):
for n in range(1, m):
if math.gcd(m, n) != 1:
continue
if (m % 2) == (n % 2):
continue # 必须一个奇数一个偶数
current_sum = 2 * m * (m + n)
if current_sum > max_sum_abc:
continue
count += 1
print(count % 1000003)
if __name__ == '__main__':
main()
gew1fw