結果

問題 No.557 点対称
ユーザー bal4u
提出日時 2019-05-12 07:52:47
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 29,184 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-02 01:28:47
合計ジャッジ時間 1,183 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicoder: No.557 点対称
// 2019.5.12 bal4u

#include <stdio.h>

#define M 1000000007

int bigpow(int x, long long p)
{
	int r = 1;
	while (p) {
		if (p & 1) r = (long long)r * x % M;
		x = (long long)x * x % M;
		p >>= 1;
	}
	return r;
}

int main()
{
	int ans;
	long long N;
	
	scanf("%lld", &N);
	if (N == 1) ans = 2;
	else {
		ans = 4; if (N & 1) ans = 12;
		ans = (long long)ans * bigpow(5, (N>>1)-1) % M;
	}
	printf("%d\n", ans);
	return 0;
}
0