結果
問題 | No.2891 Mint |
ユーザー |
|
提出日時 | 2024-09-13 21:45:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 378 ms / 2,000 ms |
コード長 | 555 bytes |
コンパイル時間 | 2,067 ms |
コンパイル使用メモリ | 195,528 KB |
最終ジャッジ日時 | 2025-02-24 07:28:11 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #include<atcoder/modint> using namespace atcoder; using mint =modint998244353; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll N,M; cin>>N>>M; mint an=mint(M)*mint(N); ll d=1; while(d<=M){ ll L=M/d; ll R=M/(d+1); if(min(N,L)-R>0){ mint p=min(N,L); mint q=R; an-=(p*(p+1)-q*(q+1))/mint(2)*mint(d); } if(R==0)break; d=M/R; } cout<<an.val()<<endl; }