結果
問題 | No.557 点対称 |
ユーザー |
![]() |
提出日時 | 2017-08-11 22:36:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 1,533 ms |
コンパイル使用メモリ | 165,656 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 21:18:17 |
合計ジャッジ時間 | 2,267 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define rep(i, N) for (int i = 0; i < N; i++)typedef long long ll;const int MOD = 1e9 + 7;const ll INF = LLONG_MAX / 2;int pow_mod(ll x, ll n, int M) {ll ans = 1;for (; n; n>>=1) {if (n & 1) ans = ans * x % M;x = x * x % M;}return ans;}int main() {ll n; cin >> n;if (n == 1) {cout << 2 << endl;return 0;}ll ans = 1;if (n % 2) ans = 3;ans = ans * 4;ans = ans * pow_mod(5, n / 2 - 1, MOD) % MOD;cout << ans << endl;}