結果
問題 |
No.2880 Max Sigma Mod
|
ユーザー |
|
提出日時 | 2024-08-01 19:30:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 565 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 17,824 KB |
最終ジャッジ日時 | 2024-08-01 19:30:15 |
合計ジャッジ時間 | 4,308 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 5 TLE * 1 -- * 42 |
ソースコード
# 入力を受け取る N, M = map(int, input().split()) # 「増加分」の計算 O(√x) def calc(x : int): res = 0 i = 1 while i * i <= x: if x % i == 0: if i <= M: res -= i # i * i == x の時は i == x / i なので重複してしまう if i * i != x and x // i <= M: res -= x // i i += 1 return res # 1 <= x <= N を満たすxについて sum(x mod i) の最大値を計算 res = 0 modsum = 0 for x in range(1, N + 1): modsum += M + calc(x) res = max(res, modsum) print(res)