結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー tatsukawa
提出日時 2017-02-25 20:18:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 3,442 ms
コンパイル使用メモリ 165,320 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 15:07:48
合計ジャッジ時間 2,229 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define get_variable_name(x) #x
#define debug(x) cout << #x << " = " << x << endl
#define rep(i, begin, end) for(int (i) = (begin); (i) < (end); (i)++)

using namespace std;
using ll = int64_t;

int main() {
    ios::sync_with_stdio(false);

    int M;
    const ll x = 2017;
    cin >> M;

    ll ans = 1;

    for(int i = 0; i < 2*x; i++) {
        ans *= x;
        ans %= M;
    }

    cout << (ans + x) % M << endl;
}


0