結果
問題 | No.2417 Div Count |
ユーザー |
|
提出日時 | 2023-07-26 12:55:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 1,665 ms |
コンパイル使用メモリ | 196,616 KB |
最終ジャッジ日時 | 2025-02-15 19:12:48 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h>using namespace std;template <typename T>vector<T> divisor(T n){T rt = sqrt(n);vector<T> res, resB;for(T i = 1; i * i <= n; i++){if(n % i == 0){res.push_back(i);T j = n / i;if(j != rt){resB.push_back(j);}}}for(int i = (int) resB.size() - 1; i >= 0; i--){res.push_back(resB[i]);}return res;}int main(){ios::sync_with_stdio(false);cin.tie(nullptr);long long n, k; cin >> n >> k;long long m = n - k;int ans = 0;vector<long long> div = divisor(m);for(auto &x : div){if(x > k) ans++;}cout << ans << endl;}