結果
問題 | No.557 点対称 |
ユーザー |
![]() |
提出日時 | 2017-08-11 23:32:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 702 ms |
コンパイル使用メモリ | 63,592 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 22:01:07 |
合計ジャッジ時間 | 1,429 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <algorithm> #include <cstdlib> #include <iostream> #include <vector> #include <math.h> using namespace std; #define int long long int MOD = 1000000007; int pow5(int n) { if (n == 0) { return 1; } int res = pow5(n / 2); res= (res*res) % MOD; if (n % 2 == 1) { res = (res * 5) % MOD; } return res; } signed main() { int N; cin >> N; int res = 4; if (N == 1) { res = 2; } else { res = (res * pow5((N / 2) - 1)) % MOD; if (N % 2 == 1) { res = (res * 3) % MOD; } } cout << res << endl; return 0; }