結果

問題 No.673 カブトムシ
ユーザー ama_nukoama_nuko
提出日時 2018-07-12 19:29:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 863 bytes
コンパイル時間 884 ms
コンパイル使用メモリ 96,580 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 12:41:21
合計ジャッジ時間 1,710 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 6 ms
6,940 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 2 ms
6,944 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

int powM(int x, int n){
    if(n == 0){
        return 1;
    }
    if(n % 2 == 0){
        return powM(x * x % MOD, n / 2);
    }
    return powM(x, n-1) * x % MOD;
}

signed main(){
    int b, c, d;
    cin >> b >> c >> d;

    if(c == 1){
        cout << b * d % MOD << endl;
        return 0;
    }

    int ans = b * c % MOD * ((MOD + powM(c, d) - 1) % MOD) % MOD * powM(c - 1, MOD - 2) % MOD;
    cout << ans << endl;

    return 0;
}
0