0TPS
  • 板块P11184 带余除法
  • 楼主NOROR
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/10/14 19:57
  • 上次更新2024/10/14 21:10:40
查看原帖
0TPS
1256290
NOROR楼主2024/10/14 19:57
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int T;
ll n,k,sum;
queue<ll> s;
int cz(int i)
{
	queue<ll> a=s;
	while(!a.empty())
	{
		if(a.front()==i)
		{
			return 0;
		}
		a.pop();
	}
	return 1;
}
int main()
{
	cin>>T;
	while(T--)
	{
		cin>>n>>k;
		if(k==0)
		{
			cout<<1<<endl;
			continue;
		}
		for(ll i=(n/(k+1));i<n/k;i++)
		{
			if(s.empty()) s.push(n%i);
			else
			{
				if(cz(n%i))
				{
					s.push(n%i);
				}
			}
		}
		cout<<s.size()<<endl;
	}
	return 0;
}

2024/10/14 19:57
加载中...