結果
問題 | No.2417 Div Count |
ユーザー |
|
提出日時 | 2024-03-05 14:04:35 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 950 ms |
コンパイル使用メモリ | 99,436 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 17:55:59 |
合計ジャッジ時間 | 2,067 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;using ll = long long;vector<ll> enum_divs (ll x) {vector<ll> res;for (int i = 1; i <= x; i++) {if (x < 1LL * i * i) break;if (x % i == 0) {res.push_back(i);if (x / i != i) res.push_back(x/i);}}sort(res.begin(), res.end());return res;}int main () {ll N, K; cin >> N >> K;auto divs = enum_divs(N-K);int ans = 0;for (auto& v : divs) if (K < v) ans++;cout << ans << "\n";}