結果

問題 No.557 点対称
ユーザー koba-e964
提出日時 2017-08-11 22:57:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,050 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 86,316 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 21:38:34
合計ジャッジ時間 1,525 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;

const ll mod = 1e9 + 7;

ll powmod(ll a, ll e) {
  ll sum = 1;
  ll cur = a;
  while (e > 0) {
    if (e % 2) {
      sum = sum * cur % mod;
    }
    cur = cur * cur % mod;
    e /= 2;
  }
  return sum;
}


int main(void) {
  ll n;
  cin >> n;
  ll prod = 1;
  if (n >= 2) {
    prod = 4 * powmod(5, n / 2 - 1) % mod;
  }
  if (n % 2 == 1) {
    if (n >= 3) {
      prod = prod * 3 % mod;
    } else {
      prod = 2;
    }
  }
  cout << prod << endl;
}
0