結果
| 問題 |
No.793 うし数列 2
|
| コンテスト | |
| ユーザー |
kaito_tateyama
|
| 提出日時 | 2019-03-07 11:53:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,007 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 74,012 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 14:47:45 |
| 合計ジャッジ時間 | 1,382 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 18 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define P(x) cout << (x) << "\n"
#define D(x) cerr << (x) << "\n"
#define fcout cout << fixed << setprecision(18)
using i64 = long long int; // 10^18
static const i64 MOD = 1000000007;
i64 modpow(i64 base, i64 power, i64 mod) {
i64 res = 1;
if(power==0) res = 1;
else if(power%2==0)res = ((modpow(base, power/2, mod)%mod)*(modpow(base, power/2, mod)%mod))%mod;
else if(power%2==1)res = (base*modpow(base, power/2, mod))%mod;
return res;
}
i64 moddiv(i64 a, i64 b, i64 mod) {
i64 s = mod,t = b,u=1,v=0;
while(s) {
i64 e = t/s;
swap(t-=e*s, s);
swap(u-=e*v, v);
}
if(u<0)u+=mod;
return a*u % mod;
}
i64 moden(i64 x)
{
return moddiv(4 * pow(10, x) - 1, 3, MOD);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
i64 n;cin>>n;
P(moden(n));
return 0;
}
kaito_tateyama