結果
問題 | No.2417 Div Count |
ユーザー | dyktr_06 |
提出日時 | 2023-07-26 12:55:19 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 719 bytes |
コンパイル時間 | 2,264 ms |
コンパイル使用メモリ | 202,864 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 22:44:04 |
合計ジャッジ時間 | 3,364 ms |
ジャッジサーバー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; }