結果

問題 No.2417 Div Count
ユーザー ryota2357ryota2357
提出日時 2023-07-11 14:48:41
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 4,693 ms
コンパイル使用メモリ 83,052 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-10-11 06:05:38
合計ジャッジ時間 3,299 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
4,372 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cassert>
#include <set>
using namespace std;
using ll = long long;

int div_count(ll n) {
	int res = 0;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
        	res += 2;
        }
    }
    return res;
}

int main() {
    ll n, k;
    cin >> n >> k;
    assert(1 <= n && n <= 1000000000000);
    assert(0 <= k && k < n);
    n -= k;
    int ans = div_count(n);
    if (k == 0) {
        cout << ans << endl;
    } else {
        cout << ans - 1 << endl;
    }
    return 0;
}
0