結果

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

ソースコード

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(0, 1 << 28);
  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