結果
| 問題 |
No.136 Yet Another GCD Problem
|
| コンテスト | |
| ユーザー |
cormoran
|
| 提出日時 | 2016-08-25 22:11:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 826 bytes |
| コンパイル時間 | 1,725 ms |
| コンパイル使用メモリ | 168,852 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 02:24:27 |
| 合計ジャッジ時間 | 2,753 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
class Solver {
public:
bool solve() {
int N, K; cin >> N >> K;
int a, b;
tie(a, b) = [] (int X) {
repeat(i, 2, min<int>(X, sqrt(X) + 1)) if(X % i == 0) {
return make_tuple(i, X / i);
}
return make_tuple(1, X);
}(N);
if(a == 1) cout << 1 << endl;
else cout << b << endl;
return 0;
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
Solver s;
s.solve();
return 0;
}
cormoran