結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー rinrinta121rinrinta121
提出日時 2019-04-27 20:20:37
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 74,108 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-19 17:47:45
合計ジャッジ時間 1,516 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;

template<class T>
bool chmin(T& a,T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

ll h[100010];
ll dp[100010];

int main()
{
    ll m;
    cin >> m;
    ll n = 2017 % m;
    ll k = (n * n) % m ;
    for(int i = 0 ; i < 2017; i++){
        k *= k;
        k %= m;
    }
    cout << (k + 2017) % m << endl;
}
0