結果

問題 No.557 点対称
ユーザー
提出日時 2020-11-12 07:32:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 1,051 ms
コンパイル使用メモリ 91,988 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 18:59:15
合計ジャッジ時間 1,674 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	long long n;
	cin >> n;
	if (n == 1) {
		cout << "2" << endl;
		return 0;
	}
	long long x = 5;
	long long y = n / 2 - 1;
	long long ans = 1;
	while (y > 0) {
		if ((y & 1) == 1) {
			ans = ans * x % 1000000007;
		}
		x = x * x % 1000000007;
		y >>= 1;
	}
	if (n % 2 == 1) {
		ans *= 3;
	}
	cout << ans * 4 % 1000000007 << endl;
}
0