結果

問題 No.557 点対称
ユーザー square1001square1001
提出日時 2017-08-11 22:49:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 63,800 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 21:33:29
合計ジャッジ時間 1,381 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
const int mod = 1000000007;
int modpow(int a, long long b) {
	int ret = 1;
	while (b) {
		if (b & 1) ret = 1LL * ret * a % mod;
		a = 1LL * a * a % mod;
		b >>= 1;
	}
	return ret;
}
long long n;
int main() {
	cin >> n;
	if (n == 1) cout << 2 << endl;
	else {
		int ret = 4LL * modpow(5, n / 2 - 1) % mod;
		if (n % 2 == 1) ret = 3LL * ret % mod;
		cout << ret << endl;
	}
	return 0;
}
0