結果
問題 | No.793 うし数列 2 |
ユーザー |
![]() |
提出日時 | 2019-02-22 21:55:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 709 ms |
コンパイル使用メモリ | 63,824 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 08:01:58 |
合計ジャッジ時間 | 1,182 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <iostream>using namespace std;constexpr int M = 1000000007;int modexp(int x, long long e, int m) {long long ans = 1, p = x % m;while (e > 0) {if (e % 2 != 0) ans = (ans * p) % m;p = (p * p) % m;e >>= 1;}return ans;}int main() {long long n; cin >> n;long long x = modexp(10, n, M);cout << (x + (x-1) * (M+1) / 3) % M << endl;}