結果

問題 No.523 LED
ユーザー hiyokko2hiyokko2
提出日時 2017-06-03 00:06:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 865 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 80,016 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 01:58:31
合計ジャッジ時間 1,811 ms
ジャッジサーバーID
(参考情報)
judge9 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 64 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 14 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 65 ms
4,348 KB
testcase_19 AC 24 ms
4,348 KB
testcase_20 AC 22 ms
4,348 KB
testcase_21 AC 49 ms
4,348 KB
testcase_22 AC 54 ms
4,348 KB
testcase_23 AC 54 ms
4,348 KB
testcase_24 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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