Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- long long int arr[1000000],j;
- void div(long long int n)
- {
- j=0;
- for(int i=1; i<=sqrt(n); i++)
- {
- if(n%i==0)
- {
- arr[j++]=i;
- if(n/i!=i)
- arr[j++]=n/i;
- }
- }
- }
- int main()
- {
- long long int p,l,i,k,n,q,t,cas;
- cin>>t;
- for(cas=1; cas<=t; cas++)
- {
- cin>>p>>l;
- q=p-l;
- cout<<"Case "<<cas<<":";
- if(q<=l)
- {
- cout<<" impossible"<<endl;
- continue;
- }
- else
- {
- div(q);
- sort(arr,arr+j);
- long long int pos=0,flag=0;
- for(i=pos; i<j; i++)
- {
- if(arr[i]<=l)
- continue;
- cout<<" "<<arr[i];
- }
- cout<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement