結果

問題 No.557 点対称
ユーザー CELICA
提出日時 2020-09-17 21:50:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 1,830 ms
コンパイル使用メモリ 167,464 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 06:53:11
合計ジャッジ時間 1,982 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;

constexpr ll mod = 1000000007;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	ll n;
	cin >> n;

	ll ret = 1, x = 5, nn = n / 2 - 1;
	while (nn > 0)
	{
		if (nn & 1)
			ret = ret * x % mod;
		x = x * x % mod;
		nn >>= 1;
	}

	ll res;
	if (n == 1)
		res = 2;
	else if (n & 1)
		res = 12 * ret % mod;
	else
		res = 4 * ret % mod;

	cout << res << "\n";

	return 0;
}
0