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. 蓝桥杯——一步之遥,扩展gcd的应用

    1. 一步之遥 [问题描述]从昏迷中醒来,小明发现自己被关在X星球的废矿车里.矿车停在平直的废弃的轨道上.他的面前是两个按钮,分别写着“F”和“B”. 小明突然记起来,这两个按钮可以控制矿车在轨道上前 ...

  2. openfire广播broadcast插件怎么发送消息给所有用户(包括在线和离线)

    openfire广播broadcast插件怎么发送消息给所有用户(包括在线和离线): 打开openfire管理界面,找到服务器系统属性,添加一个属性(属性名:plugin.broadcast.all2 ...

  3. 使用VS开始一个新项目配置外部库的新手总结

    在使用VS做一个项目的时候,往往会需要使用各种各样的库,一般一个标准的外部库目录大体结构为: VS在配置这些库的时候有多种可行方法,但是不同的方法对于项目后续的管理和移植有不同的影响,我使用过以下三种 ...

  4. HDU - 1999 不可摸数,快速求因子和

    题意:定义s[m]为m内的因子的和,给定一个n,判断是否有s[m]==n,若没有,则是不可摸数. 思路:首先要打表求出s[m]的值,标记这些出现过的值. 打表求因子和: for(int i=1;i&l ...

  5. 浅谈服务架构“五脏六腑”之Spring Cloud

    本文将从 Spring Cloud 出发,分两小节讲述微服务框架的「五脏六腑」: 第一小节「服务架构」旨在说明的包括两点,一服务架构是什么及其必要性:二是服务架构的基本组成.为什么第一节写服务架构而不 ...

  6. gold 30min

  7. JUnit白盒测试之基本路径测试:三次找到假球

    前言 记录一次软件测试课程的课后作业,作业内容是白盒测试中的基本路径测试,步骤如下 分析程序的控制流 计算环形复杂度 找出基本路径 设计测试用例 执行测试用例(要求使用JUnit) 作业要求 使用白盒 ...

  8. 《Three.js 入门指南》0 - 说明

    本笔记,摘自:<Three.js 入门指南>一书 地址链接为:https://www.ituring.com.cn/book/miniarticle/58552 本书的前言摘录: 本书结构 ...

  9. ssh 解决经常断开与记住密码功能

    一.解决ssh经常自动断开问题 修改 /etc/ssh/sshd_config 其中对应项为 ClientAliveInterval 30 ClientAliveCountMax 3 表示每30秒发一 ...

  10. Java Interger小知识

    Integer装箱与拆箱 装箱: Integer i = 10; 相当于:Integer i = Integer.valueOf(10); 拆箱: Integer i = 10; //装箱 int t ...