結果

問題 No.557 点対称
ユーザー myantamyanta
提出日時 2017-08-11 23:50:00
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 22:10:17
合計ジャッジ時間 999 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>

using ll=long long;

#define MOD 1000000007



ll modpow(ll a, ll n)
{
	ll ret=1;
	for(;n>0;n>>=1)
	{
		if(n&1) ret=(ret*a)%MOD;
		a=(a*a)%MOD;
	}
	return ret;
}



int main(void)
{
	ll n;

	while(scanf("%lld", &n)==1)
	{
		ll ans=1;

		if(n&1) ans=3;

		ans=(ans*modpow(5, n/2-1))%MOD;
		ans=(ans*4)%MOD;

		if(n==1) ans=2;
		printf("%lld\n", ans);
	}
	return 0;
}
0