結果
| 問題 |
No.487 2017 Calculation(2017の計算)
|
| コンテスト | |
| ユーザー |
pazzle1230
|
| 提出日時 | 2017-02-24 22:26:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,439 bytes |
| コンパイル時間 | 1,074 ms |
| コンパイル使用メモリ | 90,780 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-01-02 22:44:01 |
| 合計ジャッジ時間 | 1,890 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF_LL 1e18
#define INF 1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
template<typename T>
void chmax(T &a, T &b){
a = max(a, b);
}
template<typename T>
void chmin(T &a, T &b){
a = min(a, b);
}
class Union_find{
private:
vector<int> par;
vector<int> rank;
int n;
public:
Union_find(int a){
n = a;
for(int i = 0;i < n;i++){
par.push_back(i);
rank.push_back(0);
}
}
int find(int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par[x]);
}
}
void unite(int x, int y){
x = find(x);
y = find(y);
if(x == y) return;
if(rank[x] < rank[y]){
par[x] = y;
}else{
par[y] = x;
if(rank[x] == rank[y]) rank[x]++;
}
}
bool same(int x, int y){
return find(x) == find(y);
}
};
int powm(int x, int y, int m){
int res = 1;
REP(i, y){
res *= x;
res %= m;
}
return res;
}
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
ll res = 1;
int M;
cin >> M;
res = 2017*2017;
res %= M;
res = powm(res, 2017, M);
cout << (res+2017)%M << endl;
}
pazzle1230