結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー kyo1
提出日時 2020-07-15 17:16:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 2,775 ms
コンパイル使用メモリ 191,588 KB
最終ジャッジ日時 2025-01-11 21:10:34
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t n;
  cin >> n;
  pair<int64_t, int64_t> res = make_pair(1, n);
  for (int64_t a = 1; a * a < n + 1; a++) {
    if (n % (a * a) == 0 && chmin(res.second, n / (a * a))) {
      res.first = a;
    }
  }
  cout << res.first << ' ' << res.second << '\n';
  return 0;
}
0