A Simple Task

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4313    Accepted Submission(s):
2372

Problem Description
Given a positive integer n and the odd integer o and
the nonnegative integer p such that n = o2^p.

Example

For n =
24, o = 3 and p = 3.

Task

Write a program which for each data
set:

reads a positive integer n,

computes the odd integer o and
the nonnegative integer p such that n = o2^p,

writes the
result.

 
Input
The first line of the input contains exactly one
positive integer d equal to the number of data sets, 1 <= d <= 10. The
data sets follow.

Each data set consists of exactly one line containing
exactly one integer n, 1 <= n <= 10^6.

 
Output
The output should consists of exactly d lines, one line
for each data set.

Line i, 1 <= i <= d, corresponds to the i-th
input and should contain two integers o and p separated by a single space such
that n = o2^p.

 
Sample Input
1
24
 
Sample Output
3 3
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int a,c=;
scanf("%d",&a);
while(a%==)
{
c++;
a/=;
}
printf("%d %d\n",a,c);
} return ;
}

A Simple Task的更多相关文章

  1. 计数排序 + 线段树优化 --- Codeforces 558E : A Simple Task

    E. A Simple Task Problem's Link: http://codeforces.com/problemset/problem/558/E Mean: 给定一个字符串,有q次操作, ...

  2. HDU-1339 A Simple Task

    http://acm.hdu.edu.cn/showproblem.php?pid=1339 正常做法超时,要有点小技巧存在. A Simple Task Time Limit: 2000/1000 ...

  3. Codeforces 558E A Simple Task (计数排序&&线段树优化)

    题目链接:http://codeforces.com/contest/558/problem/E E. A Simple Task time limit per test5 seconds memor ...

  4. Codeforces Round #312 (Div. 2) E. A Simple Task 线段树

    E. A Simple Task 题目连接: http://www.codeforces.com/contest/558/problem/E Description This task is very ...

  5. Codeforces Round #312 (Div. 2) E. A Simple Task 线段树+计数排序

    题目链接: http://codeforces.com/problemset/problem/558/E E. A Simple Task time limit per test5 secondsme ...

  6. 【题解】 CF11D A Simple Task

    [题解] CF11D A Simple Task 传送门 \(n \le 20\) 考虑状态压缩\(dp\). 考虑状态,\(dp(i,j,O)\)表示从\(i\)到\(j\)经过点集\(O\)的路径 ...

  7. Codeforces 558E A Simple Task(权值线段树)

    题目链接  A Simple Task 题意  给出一个小写字母序列和若干操作.每个操作为对给定区间进行升序排序或降序排序. 考虑权值线段树. 建立26棵权值线段树.每次操作的时候先把26棵线段树上的 ...

  8. A Simple Task CodeForces - 11D

    A Simple Task CodeForces - 11D 题意:输出一个无向图的简单环数量.简单环指无重复边的环.保证图无重边自环. ans[i][j]表示"包含i中的点,以i中第一个点 ...

  9. Codeforces Round #312 (Div. 2) E. A Simple Task 线段树 延时标记

    E. A Simple Task time limit per test5 seconds memory limit per test512 megabytes inputstandard input ...

随机推荐

  1. hdu just a hook(线段树,区间修改)

    Just a Hook Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  2. Effective Java从零开始 - 就是爱Java

    或许你已经开始写Java了,或许只是想要一窥这个的世界,无论是抱着何种心情来看Java,从零开始,会一种没有负担,没有包袱的事,你会发现写程序不再是枯燥乏味,孤单寂寞的一个人,而是生活中最快乐的学习之 ...

  3. 九、 合成(Composite)模式 --结构模式(Structural Pattern)

    合成模式:有时又叫做部分-整体模式(Part-Whole).合成模式将对象组织到树结构中,可以用来描述整体与部分的关系.合成模式可以使客户端将单纯元素与复合元素同等看待. 合成模式分为安全式和透明式 ...

  4. XML文档形式&JAVA抽象类和接口的区别&拦截器过滤器区别

    XML文档定义有几种形式?它们之间有何本质区别?解析XML文档有哪几种方式? a: 两种形式 dtd schemab: 本质区别:schema本身是xml的,可以被XML解析器解析(这也是从DTD上发 ...

  5. Quartz.NET作业调度框架详解

    Quartz.NET作业调度框架详解 http://www.cnblogs.com/lmule/archive/2010/08/28/1811042.html

  6. Google street、Google satellite 、百度地图Iframe切换桥接JS

    1.地图切换方法 注意:父页面访问Iframe页面JS方法需根据Iframe的名字来调用如:named "mapIfame" 即 mapIfame.window.iframeFun ...

  7. 【HDU 2586 How far away?】LCA问题 Tarjan算法

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586 题意:给出一棵n个节点的无根树,每条边有各自的权值.给出m个查询,对于每条查询返回节点u到v的最 ...

  8. find -exec

    find -exec 的标准写法 find ./ -name "*.tmp" -exec rm -rf "{}" \; find -exec 这个命令组合很好用 ...

  9. 【转】android 电容屏(三):驱动调试之驱动程序分析篇

    关键词:android  电容屏 tp 工作队列 中断 坐点计算  电容屏主要参数平台信息:内核:linux2.6/linux3.0系统:android/android4.0  平台:S5PV310( ...

  10. PHP Database ODBC 之 ODBC

    ODBC 是一种应用程序编程接口(Application Programming Interface,API),使我们有能力连接到某个数据源(比如一个 MS Access 数据库). 创建 ODBC ...