Ekka and his friend Dokka decided to buy a cake. They both love cakes and that's why they want to share the cake after buying it. As the name suggested that Ekka is very fond of odd numbers and Dokka is very fond of even numbers, they want to divide the cake such that Ekka gets a share of Nsquare centimeters and Dokka gets a share of M square centimeters where N is odd and M is even. Both N and M are positive integers.

They want to divide the cake such that N * M = W, where W is the dashing factor set by them. Now you know their dashing factor, you have to find whether they can buy the desired cake or not.

Input

Input starts with an integer T (≤ 10000), denoting the number of test cases.

Each case contains an integer W (2 ≤ W < 263). And W will not be a power of 2.

Output

For each case, print the case number first. After that print "Impossible" if they can't buy their desired cake. If they can buy such a cake, you have to print N and M. If there are multiple solutions, then print the result where M is as small as possible.

Sample Input

3

10

5

12

Sample Output

Case 1: 5 2

Case 2: Impossible

Case 3: 3 4

题目大意:就是判断一个数是否可以分解为一个奇数和一个偶数的乘积,并且使偶数最小

题解  先判断如果是奇数的话,直接输出impossible ,因为他不可能存在偶数因子,对于偶数,首先2是一个因子,然后循环除以2直到原数字变成了奇数就可以了

#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
int main(){
int t;
scanf("%d",&t);
for(int i=;i<=t;i++){
ll x;
scanf("%lld",&x); if(x&) {
printf("Case %d: Impossible\n",i);
} else {
ll ans=,t=;
while(x%==){
x=x/;
ans*=;
}
printf("Case %d: %lld %lld\n",i,x,ans);
}
}
return ;
}

最新文章

  1. SpringMvc的简单介绍
  2. Hibernate第三次测试错题解析
  3. Calling startActivity() from outside of an Activity
  4. zabbix自动发现监控url
  5. 25条提高iOS app性能的方法和技巧
  6. maven配置编译路径
  7. java 子类的实例化和代码块初始化过程
  8. for update被锁定解锁
  9. 关于WinForm/Web如何使用缓存Cach
  10. [[UIScreen mainScreen] scale]详解
  11. HDU 4121 Xiangqi
  12. [翻译]如何编写GIMP插件(二)
  13. JDK源码之AQS源码剖析
  14. Spring MVC的文件上传
  15. Hive总结(七)Hive四种数据导入方式
  16. Python学习之路——迭代器
  17. java集合性能
  18. Ketlle
  19. 联盟链初识以及Fabric环境搭建流程
  20. HDU - 4370 0 or 1

热门文章

  1. 第七周java实验作业
  2. 数据库-Mysql语句
  3. [BFS]Codeforces Igor In the Museum
  4. CF codeforces A. New Year Garland【Educational Codeforces Round 79 (Rated for Div. 2)】
  5. Javascript之盒子拖拽(跟随鼠标、边界限定、轨迹回放)
  6. Python中的数值类型总结
  7. 证明与计算(7): 有限状态机(Finite State Machine)
  8. 基于 HTML5 WebGL 的故宫人流量动态监控系统
  9. 移动深度学习 Mobile-deep-learning(MDL)
  10. Flume数据采集结合etcd作为配置中心在爬虫数据采集处理中的架构实践。