結果
問題 | No.2417 Div Count |
ユーザー |
|
提出日時 | 2023-10-23 19:44:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 590 bytes |
コンパイル時間 | 1,691 ms |
コンパイル使用メモリ | 174,012 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 13:27:32 |
合計ジャッジ時間 | 3,214 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.emplace_back(i);if(i*i != N) res.emplace_back(N/i);}sort(res.begin(), res.end());return res;}int main(){ll N, K;cin >> N >> K;vector<ll> div = divisor(N-K);int ans = 0;for(ll &d : div){if(d > K) ans++;}cout << ans << endl;return 0;}