結果

問題 No.2417 Div Count
ユーザー Ywestbuilderk
提出日時 2024-01-23 15:47:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 79,120 KB
最終ジャッジ日時 2025-02-18 22:23:55
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define int long long
signed main(){
	int n,k;
	cin >> n >> k;
	n -= k;
	vector<int> a;
	for(int i = 1;i * i <= n;i++){
		if(i * i == n) a.push_back(i);
		else if(n % i == 0){
			a.push_back(i);
			a.push_back(n / i);
		}
	}
	sort(a.begin(),a.end());
	int k1 = lower_bound(a.begin(),a.end(),k + 1) - a.begin();
	if(k1 == n) cout << 0;
	else{
		cout <<  (int)a.size() - k1;
	}
}
0