結果
| 問題 | No.1844 Divisors Sum Sum |
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2026-02-08 14:09:26 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 416 ms / 3,000 ms |
| コード長 | 583 bytes |
| 記録 | |
| コンパイル時間 | 967 ms |
| コンパイル使用メモリ | 80,880 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-08 14:09:39 |
| 合計ジャッジ時間 | 9,831 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 38 |
ソースコード
#include <iostream>
#include <atcoder/modint>
#define int long long
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
// p^0 + ... + p^e
mint sum0(mint p, int e) {
return (p.pow(e + 1) - 1) / (p - 1);
}
// 0 * p^0 + ... + e * p^e
mint sum1(mint p, int e) {
mint res1 = p * (1 - p.pow(e)) / (p - 1) / (p - 1);
mint res2 = e * p.pow(e + 1) / (p - 1);
return res1 + res2;
}
signed main() {
int L; cin >> L;
mint ans = 1;
while (L--) {
int p, e; cin >> p >> e;
ans *= sum0(p, e) * (e + 1) - sum1(p, e);
}
cout << ans.val() << endl;
return 0;
}
startcpp