結果
問題 |
No.1844 Divisors Sum Sum
|
ユーザー |
|
提出日時 | 2022-02-19 01:31:41 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 638 bytes |
コンパイル時間 | 7,103 ms |
コンパイル使用メモリ | 253,228 KB |
最終ジャッジ日時 | 2025-01-28 00:55:50 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 38 |
コンパイルメッセージ
main.cpp: In function 'll mpow(ll, ll)': main.cpp:15:1: warning: no return statement in function returning non-void [-Wreturn-type] 15 | } | ^
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; ll m = 1e9 + 7; ll mpow(ll a, ll n) { ll ret = 1; while (n) { if (n % 2) { ret *= a; ret %= m; } n /= 2; a = (a * a) % m; } } int main () { int N; cin >> N; ll ans = 1; for (int i = 0; i < N; i ++) { ll p, e; cin >> p >> e; ll q = mpow(p, e + 1); q = (q * p) % m; q = (q * mpow(p - 1, m - 2)) % m; q += (m - 1); q %= m; q = (q * mpow(p - 1, m - 2)) % m; ans *= q; ans %= m; } cout << ans << endl; }