結果
問題 | No.793 うし数列 2 |
ユーザー | merom686 |
提出日時 | 2019-02-22 21:33:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 582 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 73,572 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 05:50:22 |
合計ジャッジ時間 | 1,364 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; constexpr int P = 1000000007; ll powmod(ll n, ll k) { ll r = 1, t = n % P; for (; k != 0; k /= 2) { if (k & 1) r = r * t % P; t = t * t % P; } return r; } ll inv(ll n) { return powmod(n, P - 2); } int main() { ll n; cin >> n; ll t = powmod(10, n); t = t * 4 % P; t = (t + P - 1) % P; t = t * inv(3) % P; cout << t << endl; return 0; }