60pts求助
查看原帖
60pts求助
1097517
eason815164楼主2024/10/13 13:11
#include<bits/stdc++.h>
using namespace std;
void work(){
	long long n, k;
	cin >> n >> k;
	if(k == 0){
		cout << 1 << endl;
		return;
	}
	if(k > n){
		cout << 0 << endl;
		return;
	} 
	long long m = n / k, r = n % k, ans = 0;
	while(m > r){
		ans++;
		m--;
		r += k;
	}
	cout << ans << endl;
}
int main(){
	int T;
	cin.tie(0);
	cout.tie(0);
	cin >> T;
	while(T--){
		work();
	}
	return 0;
}

2024/10/13 13:11
加载中...