結果

問題 No.2417 Div Count
ユーザー ryota2357
提出日時 2023-07-11 14:48:41
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 1,796 ms
コンパイル使用メモリ 121,216 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-13 05:20:10
合計ジャッジ時間 3,086 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 39
権限があれば一括ダウンロードができます

ソースコード

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