結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

const int mod = 1e9 + 7;

long long mod_pow(long long x, long long n){
	if(n == 0) return 1;
	long long res = mod_pow(x*x % mod, n / 2);
	if(n & 1) res = res*x % mod;
	return res;
}

signed main(){
	int n;
	cin >> n;
	int ans = 1;
	if(n == 1){
		cout << 2 << endl;
		return 0;
	}
	ans = mod_pow(5, n / 2 - 1);
	ans = 4 * ans % mod;
	if(n % 2) ans = ans * 3 % mod;
	cout << ans << endl;
}
0