#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll c, r, t, i, j, k = 1;
cin >> t;
while(t--)
{
cin >> c >> r;
set<ll>st;
ll d = c - r;
if(d == 0)
cout << "Case #" << k++ << ": 0";
else
{
ll a = sqrt(d);
for(i=1;i<=a;i++)
{
if(d%i == 0)
{
st.insert(i);
st.insert(d/i);
}
}
cout << "Case #" << k++ << ":";
for(auto it=st.begin();it!=st.end();it++)
{
if(*it > r)
cout << " " << *it;
}
}
cout << "\n";
}
return 0;
}
#define ll long long int
using namespace std;
int main()
{
ll c, r, t, i, j, k = 1;
cin >> t;
while(t--)
{
cin >> c >> r;
set<ll>st;
ll d = c - r;
if(d == 0)
cout << "Case #" << k++ << ": 0";
else
{
ll a = sqrt(d);
for(i=1;i<=a;i++)
{
if(d%i == 0)
{
st.insert(i);
st.insert(d/i);
}
}
cout << "Case #" << k++ << ":";
for(auto it=st.begin();it!=st.end();it++)
{
if(*it > r)
cout << " " << *it;
}
}
cout << "\n";
}
return 0;
}
Comments
Post a Comment