結果

問題 No.523 LED
ユーザー hiyokko2hiyokko2
提出日時 2017-06-03 00:06:29
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 865 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 80,388 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 03:40:22
合計ジャッジ時間 1,646 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>

#define int long long
//typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)

#define MOD 1000000007

using namespace std;



signed main()
{
#ifdef LOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;

    if (N == 1) {
        cout << 1 << endl;
        return 0;
    } else if (N == 2) {
        cout << 6 << endl;
        return 0;
    }

    int kakeru = 15;
    int purasu = 13;
    int pre_ans = 6;
    for (int i=3; i<=N; i++) {
        pre_ans = pre_ans * kakeru;
        pre_ans %= MOD;
        kakeru += purasu;
        kakeru %= MOD;
        purasu += 4;
        purasu %= MOD;
    }

    cout << pre_ans << endl;
}
0