結果
| 問題 |
No.673 カブトムシ
|
| コンテスト | |
| ユーザー |
lll
|
| 提出日時 | 2018-04-13 23:47:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 918 bytes |
| コンパイル時間 | 792 ms |
| コンパイル使用メモリ | 92,512 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 05:54:39 |
| 合計ジャッジ時間 | 1,384 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 |
ソースコード
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
ll powmod(ll a, ll b) {
ll ret = 1;
while (b) {
if (b % 2 == 1) {
ret = (ret * a) % mod;
}
a = (a * a) % mod;
b /= 2;
}
return ret;
}
ll sum(ll a, ll r, ll n) {
if (n == 1) {
return a % mod;
}
ll x = sum(a, r, n / 2);
ll ret = (x + powmod(r, n / 2) * x) % mod;
if (n % 2 == 1) {
ret = (a + r * ret) % mod;
}
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll B, C, D;
cin >> B >> C >> D;
B %= mod;
C %= mod;
cout << (B * sum(C, C, D)) % mod << endl;
return 0;
}
lll