結果

問題 No.557 点対称
ユーザー mogurocker
提出日時 2017-10-15 04:36:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 684 bytes
コンパイル時間 1,593 ms
コンパイル使用メモリ 158,872 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 15:08:04
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

ll n, MOD = 1000000007;

ll mod_pow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return res;
}

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	if (n == 1) cout << 2 << endl;
	else {
		ll ret = 4;
		ret = ret * mod_pow(5, n/2-1) % MOD;
		if (n & 1) ret = ret * 3 % MOD;
		cout << ret << endl;
	}
	return 0;
}
0