結果
| 問題 |
No.2940 Sigma Sigma Div Floor Problem
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2024-10-19 20:37:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 195 ms / 6,000 ms |
| コード長 | 563 bytes |
| コンパイル時間 | 2,127 ms |
| コンパイル使用メモリ | 195,292 KB |
| 最終ジャッジ日時 | 2025-02-24 21:41:59 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using ll = long long;
using namespace atcoder;
using mint = modint998244353;
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll N;
mint S=0, q, r;
cin >> N;
for (int j=1; j<=N; j++){
//i=kj, kj+1, ... (k+1)j-1はi/j=kでj個
//N=qj+rと表されるなら0,~,(q-1)がj個
//qがr+1個ある
q = N/j;
r = N%j;
S += q*(q-1)/2*j;
S += q*(r+1);
}
cout << S.val() << endl;
return 0;
}
srjywrdnprkt