- #include <bits/stdc++.h>
- using namespace std;
- vector<int>v;
- int main(){
- int ts;
- cin>>ts;
- for(int k = 1; k <=ts ; k++){
- int p, l;
- scanf("%d%d", &p, &l);
- int n = p-l;
- for(int i = 1; i <= sqrt(n); i++){
- if(n%i == 0 ){
- if(n/i != i){
- if((n/i)>l) v.push_back(n/i);
- if(i>l)v.push_back(i);
- }
- else{
- if(i>l)v.push_back(i);
- }
- }
- }
- if(v.size() == 0){printf("Case %d: impossible\n", k);}
- else {
- sort(v.begin(), v.end());
- printf("Case %d: ",k);
- int j = 0;
- for(j = 0; j <v.size()-1; j++){
- printf("%d ", v[j]);
- }
- printf("%d\n",v[j]);
- }
- v.clear();
- }
- return 0;
- }
Friday 28 July 2017
Lightoj 1014 - Ifter Party
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
Problem link: Problem Analysis: It is actually a basic Bisection problem , as we can see here we can not actually find a formula fo...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
No comments:
Post a Comment