結果

問題 No.2271 平方根の13桁精度近似計算
ユーザー 👑 hitonanodehitonanode
提出日時 2023-05-29 23:09:01
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,526 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-28 00:05:12
合計ジャッジ時間 23,367 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1,014 ms
4,376 KB
testcase_08 AC 1,011 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 347 ms
4,376 KB
testcase_11 AC 258 ms
4,380 KB
testcase_12 AC 1,519 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1,011 ms
4,376 KB
testcase_15 AC 231 ms
4,376 KB
testcase_16 AC 1,512 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1,483 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1,012 ms
4,380 KB
testcase_22 AC 294 ms
4,376 KB
testcase_23 AC 1,501 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1,011 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1,202 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1,479 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1,009 ms
4,376 KB
testcase_33 AC 326 ms
4,380 KB
testcase_34 AC 1,526 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1,479 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1,016 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <iostream>
using namespace std;

using lint = long long;

int dist(lint x) {
    if (x == 0) return 100;
    int ret = 0;
    while (x % 5 == 0) x /= 5, ret++;
    return ret;
}

int main() {
    int N, E;
    cin >> N >> E;

    lint ret = -1;
    for (int current = 0; current <= (1 << 29); ++current) {
        if (dist(lint(current) * current - N) >= E) {
            ret = current;
            break;
        }
    }

    // assert(ret <= (1 << 29));
    if (ret >= 0) {
        cout << ret << endl;
    } else {
        puts("NaN");
    }
}
0