結果

問題 No.487 2017 Calculation(2017の計算)
ユーザー こるこる
提出日時 2017-02-24 23:55:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,222 bytes
コンパイル時間 877 ms
コンパイル使用メモリ 83,856 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-31 00:17:28
合計ジャッジ時間 1,706 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<algorithm>
#include<queue>
#include<functional>
#include<numeric>
#include<sstream>
#include<math.h>
#include <iomanip>
#define ll long long
#define PLL pair<ll,ll>
#define VS vector<string>
#define VL vector<ll>
#define VB vector<bool>
#define VPLL vector<pair<ll,ll> >
#define VVL vector<vector<ll> >
#define VVVL vector<vector<vector<ll> > >
#define VVB vector<vector<bool> >
#define rep(i,a) for (ll i=0;i<a;i++)
#define nrep(i,n,a) for (ll i=n;i<a;i++)
#define mrep(i,a) for(ll i=a;i>=0;i--)
#define INF 1000000000000000000
#define PI 3.141592653589793238
#define vmin(vec) *std::min_element(vec.begin(),vec.end())
#define vmax(vec) *std::max_element(vec.begin(),vec.end())
#define vsum(vec) std::accumulate(vec.begin(),vec.end(),0LL)
#define ksort(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define ssort(vec) (vec.begin(),vec.end())
#define VPLLsort(vec) sort(vec.begin(), vec.end(),[](PLL &a, PLL &b){ return a.first < b.first; });
#define LTS(n) to_string(n)
#define STL(str) stoll(str)
using namespace std;

/*
int main() {
	ll n, d, k;
	cin >> n >> d >> k;
	VL x(n); rep(i, n) cin >> x[i];
	ll maxi = -1;
	ll mini_index = 0;
	PLL ans;
	ans.first = 0;
	ans.second = 0;
	nrep(i,1, n){
		if (maxi < x[i] - x[ans.first] && i-ans.first<=d){
			maxi = x[i] - x[ans.first];
			ans.second = i;
		}if (x[ans.first]>x[i]){
			ans.first = i;
		}if (x[ans.first] == x[i]&&i-ans.first>=d){
			mini_index = i;
		}if (maxi<x[i] - x[mini_index] && i - mini_index <= d){
			maxi = x[i] - x[mini_index];
			ans.second = i;
			ans.first = mini_index;
		}
	}if (maxi <= 0){
		cout << 0 << endl;
	}
	else{
		mrep(i, ans.first){
			if (ans.second - i>d) break;
			if (x[i] == x[ans.first]) ans.first = i;
		}
		cout << maxi*k << endl;
		cout << ans.first << " " << ans.second << endl;
	}
*/

ll mod;

ll pow(ll x, ll n){
	x %= mod;
	if (n == 1) return x;
	if (n == 0) return 1;
	if (n % 2 == 0) return pow(x*x, n / 2) % mod;
	else return (pow(x, n - 1)*x) % mod;
}

int main(){
	cin >> mod;
	ll num = 2017 % mod;
	ll num2 = (2017 * 2017)%mod;
	ll ans =1;
	rep(i, 2017) ans = (num2*ans) % mod;
	ll x = num +ans%mod;
	cout << x%mod << endl;
	return 0;
}
0