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. ajax + php + Controller 控制所有后台函数调用

    转载请注明出处:http://www.cnblogs.com/ghypnus/p/4645873.html 好久没有来这边发布代码了 总共分成3大部分来完成php的ajax调用逻辑,以下是大致的结构 ...

  2. sitemap.xml 静态和动态生成页面 shopnc二次开发 动态生成sitemap.xml

    Sitemap 可方便网站管理员通知搜索引擎他们网站上有哪些可供抓取的网页.最简单的 Sitemap 形式,就是XML 文件,在其中列出网站中的网址以及关于每个网址的其他元数据(上次更新的时间.更改的 ...

  3. python 连接操作数据库(一)

    一.下面我们所说的就是连接mysql的应用: 1.其实在python中连接操作mysql的模块有多个,在这里我只给大家演示pymysql这一个模块(其实我是感觉它比较好用而已): pymysql是第三 ...

  4. 在Cocos2d-X中新建Android项目

    Windows下创建Cocos2d-X的Android项目并不复杂,关键是要改几个环境变量 一.进入Cocos2d-X主目录修改“create-android-project.bat” 大家都知道要点 ...

  5. php修改配置文件php.ini设置文件上传大小讲解

    打开php.ini,首先找到;;;;;;;;;;;;;;;;; File Uploads ;;;;;;;;;;;;;;;;;区域,有影响文件上传的以下几个参数: file_uploads   =   ...

  6. ArcGIS 栅格数据已加载后的获取

    原文 http://www.cnblogs.com/zoe-j/archive/2012/02/16/2354037.html 简单记一下,最近开始做Arcgis engine的开发, 已经通过了to ...

  7. android gridview布局,实现长按某一个,所有项都显示删除的图标

    最近一直忙着项目开发,有段时间没有写博文了,今天想跟大家分享的是长按gridview中的某一项显示删除图标,此时点击某项便可删除,再长按取消删除图标. gridview的布局文件如下: <?xm ...

  8. mybatis第一个入门demo

    学习框架技术,一般先写个demo,先知道是什么,然后在知道为什么,这也是进步的一种. 源码链接:http://pan.baidu.com/s/1eQJ2wLG

  9. ysql+heartbeat+DRBD+LVS实现mysql高可用

    在企业应用中,mysql+heartbeat+DRBD+LVS是一套成熟的集群解决方案,通过heart+DRBD实现mysql的主 节点写操作的高可用性,而通过mysql+LVS实现数据库的主从复制和 ...

  10. nginx+vaadin配置

    nginx+Vaadin的特殊性在于配置WEBSOCKET或LONG_POLLING.网上资料不多,自己多次尝试配置都不成功,后来终于找到这篇说明才得以配置成功,使用效果不错,介绍如下. 1./etc ...