#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int i,j,x,w,n,k;
cin>>n;
for(k=1;k<=n;k++)
{
bool flag=0;
cin>>w;
if(w%2==1)
cout<<"Case "<<k<<": "<<"Impossible"<<endl;
else
{
for(i=2;i<=(w/2);i=i*2)
{
if((w/i)%2==1&&((w/i)*i)==w)
{
flag=1;
break;
}
}
if(flag==1)
cout<<"Case "<<k<<": "<<(w/i)<<" "<<i<<endl;
else
cout<<"Case "<<k<<": "<<"Impossible"<<endl;
}
}
return 0;
}
using namespace std;
int main()
{
long long int i,j,x,w,n,k;
cin>>n;
for(k=1;k<=n;k++)
{
bool flag=0;
cin>>w;
if(w%2==1)
cout<<"Case "<<k<<": "<<"Impossible"<<endl;
else
{
for(i=2;i<=(w/2);i=i*2)
{
if((w/i)%2==1&&((w/i)*i)==w)
{
flag=1;
break;
}
}
if(flag==1)
cout<<"Case "<<k<<": "<<(w/i)<<" "<<i<<endl;
else
cout<<"Case "<<k<<": "<<"Impossible"<<endl;
}
}
return 0;
}
No comments:
Post a Comment