結果
問題 | No.2417 Div Count |
ユーザー |
![]() |
提出日時 | 2024-06-15 12:12:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 609 bytes |
コンパイル時間 | 1,974 ms |
コンパイル使用メモリ | 173,928 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-15 12:12:27 |
合計ジャッジ時間 | 3,907 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;#define rep(i,m,n) for(int i=m; i<n; ++i)#define repl(i,m,n) for(ll i=m; i<n; ++i)vector<ll> divisor(ll n){vector<ll> res;for(ll i = 1LL; i*i <= n; ++i){if(n % i != 0LL) continue;res.push_back(i);if(i*i != n) res.push_back(n / i);}sort(res.begin(), res.end());return res;}int main(){ll N, K;cin >> N >> K;int ans = 0;vector<ll> div = divisor(N - K);for(ll d : div){if(d <= K) continue;ans++;}cout << ans << endl;return 0;}