結果
| 問題 |
No.2880 Max Sigma Mod
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-08 12:46:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2,454 ms / 3,000 ms |
| コード長 | 560 bytes |
| コンパイル時間 | 1,878 ms |
| コンパイル使用メモリ | 192,160 KB |
| 最終ジャッジ日時 | 2025-02-24 05:24:29 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 48 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N,M; cin >> N >> M;
long long answer = 0;
for(int i=1; i<=N; i++){
long long now = 1LL*i*M;
long long k;
for(k=1; k*k<=N&&k<=M; k++) now -= i/k*k;
while(i/k && k<=M){
long long dec = i/k;
long long maxk = i/dec;
now -= dec*(maxk*(maxk+1)/2-(k-1)*k/2);
k = maxk+1;
}
answer = max(answer,now);
}
cout << answer << endl;
}