結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー kpinkcat
提出日時 2023-08-26 18:50:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 100,740 KB
最終ジャッジ日時 2025-02-16 14:47:00
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:22:18: warning: ‘a’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |     cout << a << " " << b << endl;
      |                  ^~~
main.cpp:14:12: note: ‘a’ was declared here
   14 |     int n, a, b;
      |            ^
main.cpp:22:25: warning: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |     cout << a << " " << b << endl;
      |                         ^
main.cpp:14:15: note: ‘b’ was declared here
   14 |     int n, a, b;
      |               ^

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    int n, a, b;
    cin >> n;
    for (int i = 1; i <= pow(n, 0.5); i++){
        if (!(n%i) && !((n/i)%i)){
            a = i;
            b = n/i/i;
        }
    }
    cout << a << " " << b << endl;
}
0