結果
問題 |
No.673 カブトムシ
|
ユーザー |
|
提出日時 | 2018-04-13 22:44:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 932 bytes |
コンパイル時間 | 843 ms |
コンパイル使用メモリ | 73,380 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 21:49:04 |
合計ジャッジ時間 | 1,472 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 9 WA * 5 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <tuple> using namespace std; #define YES(condition) if(condition){ cout << "YES" << endl; }else{ cout << "NO" << endl; } #define Yes(condition) if(condition){ cout << "Yes" << endl; }else{ cout << "No" << endl; } #define Poss(condition) if(condition){ cout << "Possible" << endl; }else{ cout << "Impossible" << endl; } #define mod long(1e9 + 7) long power(long base, long exponent){ if(exponent % 2){ return power(base, exponent - 1) * base % mod; }else if(exponent){ long root_ans = power(base, exponent / 2); return root_ans * root_ans % mod; }else{ return 1; }} int main(){ long B, C, D; cin >> B >> C >> D; B %= mod; C %= mod; D %= mod; if(C == 1){ cout << B * D % mod << endl; return 0; } cout << B * (power(C, D + 1) - C + mod) % mod * power((C + mod - 1) % mod, mod - 2) % mod << endl; }