結果

問題 No.1063 ルートの計算 / Sqrt Calculation
コンテスト
ユーザー queee
提出日時 2020-05-29 22:28:40
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 394µs
コード長 810 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 629 ms
コンパイル使用メモリ 98,432 KB
実行使用メモリ 10,032 KB
最終ジャッジ日時 2026-09-19 13:35:17
合計ジャッジ時間 2,069 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#pragma GCC target("avx")
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <functional>
#define DB puts("D")
#define pb push_back

using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";}
template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";}
template<typename T> void caut(T a){cout<<"("<<a<<") ";}
void input(int a[], int n){for(int i=0;i<n;i++) cin>>a[i];}

using P=pair<ll,ll>;
const ll M = 1e9+7;

int main() {
  int n; cin>>n;
  int k=1;
  for(int i=2;i*i<=n;i++) {
    while(n%(i*i)==0) n/=i*i,k*=i;
  }
  cout<<k<<" "<<n<<endl;
}
0