結果
問題 | No.557 点対称 |
ユーザー |
![]() |
提出日時 | 2017-08-11 23:12:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 1,822 ms |
コンパイル使用メモリ | 166,440 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 21:46:57 |
合計ジャッジ時間 | 2,361 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MOD = ll(1e9 + 7); ll modpow(ll x, ll y, ll m) { if(y == 0) return 1; ll res = modpow(x, y / 2, m); return res * res % m * (y & 1 ? x : 1) % m; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; if(N == 1) { cout << 2 << endl; return 0; } ll ans = 1; if(N >= 2) { ans *= 4; if(N >= 4) { ans *= modpow(5, N / 2 - 1, MOD); ans %= MOD; } } if(N % 2) { ans *= 3; ans %= MOD; } cout << ans << endl; }