結果

問題 No.1500 Super Knight
ユーザー Mister
提出日時 2021-05-07 22:51:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 73,516 KB
最終ジャッジ日時 2025-01-21 08:37:37
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/modint>
#include <iostream>
#include <vector>

using namespace std;
using mint = atcoder::modint1000000007;

const vector<int> ans{1, 12, 65};

void solve() {
    int n;
    cin >> n;

    if (n <= 2) {
        cout << ans[n] << "\n";
    } else {
        n -= 2;
        cout << (mint(n) * n * 17 + mint(n) * 74 + 81).val() << "\n";
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0