結果
問題 |
No.557 点対称
|
ユーザー |
![]() |
提出日時 | 2017-08-14 01:12:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 920 bytes |
コンパイル時間 | 673 ms |
コンパイル使用メモリ | 83,396 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 09:24:29 |
合計ジャッジ時間 | 1,438 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
/* -*- coding: utf-8 -*- * * 557.cc: No.557 点対称 - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ typedef long long ll; const ll MOD = 1000000007; /* typedef */ /* global variables */ /* subroutines */ inline ll powmod(ll a, ll b) { // a^b ll pm = 1; while (b > 0) { if ((b & 1LL) != 0) pm = (pm * a) % MOD; a = (a * a) % MOD; b >>= 1; } return pm; } /* main */ int main() { ll n; cin >> n; if (n == 1) puts("2"); else { ll nh = n / 2; ll p = (4LL * powmod(5, nh - 1)) % MOD; if (n & 1) p = (p * 3) % MOD; printf("%lld\n", p); } return 0; }