結果
| 問題 | No.2880 Max Sigma Mod |
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-09-08 13:17:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 204 ms / 3,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 1,830 ms |
| コンパイル使用メモリ | 194,712 KB |
| 最終ジャッジ日時 | 2025-02-24 05:29:50 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 48 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
vector<bool>P(N+1,true);
long ans=M-1;
long cur=1;
for(int x=2;x<=N;x++)
{
if(x<=M)cur+=x;
for(int a=1;a*a<=x;a++)
{
if(x%a==0)
{
if(a<=M)cur-=a;
if(x/a!=a&&x/a<=M)cur-=x/a;
}
}
// cout<<x<<' '<<cur<<endl;
ans=max(ans,cur+(M>x?long(M-x)*x:0L));
cur+=min(x,M);
}
cout<<ans<<endl;
}
nonon