結果
問題 |
No.557 点対称
|
ユーザー |
👑 |
提出日時 | 2019-03-31 22:49:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 874 bytes |
コンパイル時間 | 555 ms |
コンパイル使用メモリ | 72,220 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 14:27:27 |
合計ジャッジ時間 | 1,540 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <cstdio> #include <cstdlib> #include <cstddef> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <iostream> #include <iomanip> #define ASDF (1000000007) long modpow(long src, long pow, long mod) { long res = 1; while (0 < pow) { if (pow % 2 == 1) { res = (res * src) % mod; pow--; } src = (src * src) % mod; pow /= 2; } return res; } int main(void) { long n; std::cin >> n; if(n == 1){ std::cout << 2 << std::endl; } else if(n == 2){ std::cout << 4 << std::endl; } else if(n == 3){ std::cout << 12 << std::endl; } else { long tot = 1 + (n % 2) * 2;//1(even) or 3(odd) // tot * 4 * 5^([n/2] - 1) tot *= 4; long cnt = n / 2 - 1; tot = (tot * modpow(5, cnt, ASDF)) % ASDF; std::cout << tot << std::endl; } return 0; }