結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー kpinkcatkpinkcat
提出日時 2023-08-26 18:50:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 854 ms
コンパイル使用メモリ 100,404 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 18:50:42
合計ジャッジ時間 1,825 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:22:25: 警告: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |     cout << a << " " << b << endl;
      |                         ^
main.cpp:14:15: 備考: ‘b’ はここで定義されています
   14 |     int n, a, b;
      |               ^
main.cpp:22:18: 警告: ‘a’ may be used uninitialized [-Wmaybe-uninitialized]
   22 |     cout << a << " " << b << endl;
      |                  ^~~
main.cpp:14:12: 備考: ‘a’ はここで定義されています
   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