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 ;
}

C - Ekka Dokka的更多相关文章

  1. light oj 1116 - Ekka Dokka

    1116 - Ekka Dokka   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Ekka ...

  2. lightoj--1116--Ekka Dokka(水题)

    Ekka Dokka Time Limit: 2000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu Submit Stat ...

  3. LightOJ Beginners Problems 部分题解

    相关代码请戳 https://coding.net/u/tiny656/p/LightOJ/git 1006 Hex-a-bonacci. 用数组模拟记录结果,注意取模 1008 Fibsieve's ...

  4. LightOJ - 1116-Ekka Dokka(思维)

    链接: https://vjudge.net/problem/LightOJ-1116 题意: Ekka and his friend Dokka decided to buy a cake. The ...

  5. spring-framework源码编译及导入

    环境说明: 时间:2017-09-26 OS name: "mac os x", version: "10.12.4", arch: "x86_64& ...

  6. Spring5源码解析-前奏:本地构建Spring5源码

    构建环境 macOS 10.13.6 JDK1.8 IntelliJ IDEA 2018.3.6 (Ultimate Edition) Spring v5.1.9.RELEASE Gradle 5.5 ...

  7. 学习Spring5源码时所遇到的坑

    学习Spring5源码时所遇到的坑 0)本人下载的源码版本是 spring-framework-5.0.2.RELEASE 配置好gradle环境变量之后,cmd进入到spring项目,执行gradl ...

  8. MQTT研究之EMQ:【EMQX使用中的一些问题记录(3)】

    EMQX功能强大,但是帮助信息或者可用资料的确有限,遇到个问题,比较难找到处理的头绪,今天,我要记录的是,使用中出现EMQX宕机,但是呢,启动也启动不了. 今天记录的内容,就以操作EMQX 3.2.3 ...

  9. intellij idea gradle 导入 spring 问题记录

    环境: windows 7 oracle jdk 1.8 intellij idea 2019.3.1 spring-framework 5.1.22.RELEASE 步骤: 1: 下载解压sprin ...

随机推荐

  1. alsa-lib及alsa-utils成功移植(转载)

    准备工作 alsa-lib版本:alsa-lib-1.0.23.tar.bz2 alsa-util版本:alsa-utils-1.0.23.tar.bz2 其他版本的alsa-lib和alsa-uti ...

  2. nopcommerce4.0 安装步骤

    前言:近期因工作要求接触nopcommerce,最新版本为4.0,以下所有安装都是基于此版本.接下来我可能会写一系列,为了让自己更好的掌握,也希望能帮助到大家 好记性不如烂笔头,新手也可以避免走我的弯 ...

  3. Redis学习笔记2-redis管道(pipeline)

    redis的管道(Pipelining)操作是一种异步的访问模式,一次发送多个指令,不同步等待其返回结果.这样可以取得非常好的执行效率.这就是管道,调用方法如下: 来源:http://blog.csd ...

  4. Tensorflow系列专题(四):神经网络篇之前馈神经网络综述

    目录: 神经网络前言 神经网络 感知机模型 多层神经网络 激活函数 Logistic函数 Tanh函数 ReLu函数 损失函数和输出单元 损失函数的选择 均方误差损失函数 交叉熵损失函数 输出单元的选 ...

  5. WEB缓存控制机制与varnish简介

    在说到缓存varnish前,我们首先来了解下对于web服务缓存到底是什么?它有哪些特点,基础原理是什么? http是web应用协议,通常我们说的一次http事务,不外乎就是客户端请求,服务端响应,通常 ...

  6. Springcloud zuul 实现API 网关

    1,https://github.com/Netflix/zuul zuul 网关文档 2,什么是网关 网关就是客户端进行访问的时候,先经过网关服务器,再由网关服务器进行转发到真实的服务器.类似于Ng ...

  7. java面试基础篇-List

    一.ArrayList: 底层为数组实现,线程不安全,查询,修改快,增加删除慢, 数据结构:数组以0为下标依次连续进行存储 数组查询元素:根据下标查询就行 数组增加元素:如果需要给index为10的位 ...

  8. layuiadmin使用Ueditor 获取不了数据的解决方法

    表单根元素请使用form元素,layuiadmin 默认使用div作为表单根元素. <form class="layui-form"> <textarea nam ...

  9. 【python系统学习13】类(class)与对象(object)

    目录: 类(class)和实例 类 实例 小测试 对象(object) 属性和方法 类的创建 伪代码 示例代码 属性(attribute) 方法(method) 类的实例化 实例对象调用类属性和方法 ...

  10. CodeForces - 817B(分类讨论 + 排列组合)

    题目链接 思路如下 这一题是:最菜的队伍只有三个人组成,我们只需对排序后的数组的 前三个元素进行分类讨论即可: a[3] != a[2] && a[3] != ar[1] a[3] = ...