HDU-1339 A Simple Task
http://acm.hdu.edu.cn/showproblem.php?pid=1339
正常做法超时,要有点小技巧存在。
A Simple Task
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3372 Accepted Submission(s): 1837
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.
Each data set consists of exactly one line containing exactly one integer n, 1 <= n <= 10^6.
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.
#include<stdio.h>
int main()
{
long int d,k,n;
scanf("%ld",&d);
while(d--)
{
scanf("%ld",&n);
k=;
while(n%==)
{ k++;
n=n/;
}
printf("%ld %ld\n",n,k);
}
return ;
}
HDU-1339 A Simple Task的更多相关文章
- HDOJ 1339 A Simple Task(简单数学题,暴力)
Problem Description Given a positive integer n and the odd integer o and the nonnegative integer p s ...
- HDU 5795 A Simple Nim(简单Nim)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- 计数排序 + 线段树优化 --- Codeforces 558E : A Simple Task
E. A Simple Task Problem's Link: http://codeforces.com/problemset/problem/558/E Mean: 给定一个字符串,有q次操作, ...
- HDU 5794 - A Simple Chess
HDU 5794 - A Simple Chess题意: 马(象棋)初始位置在(1,1), 现在要走到(n,m), 问有几种走法 棋盘上有r个障碍物, 该位置不能走, 并规定只能走右下方 数据范围: ...
- A Simple Task
A Simple Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 4974 A simple water problem(贪心)
HDU 4974 A simple water problem pid=4974" target="_blank" style="">题目链接 ...
- hdu 4972 A simple dynamic programming problem(高效)
pid=4972" target="_blank" style="">题目链接:hdu 4972 A simple dynamic progra ...
- Codeforces 558E A Simple Task (计数排序&&线段树优化)
题目链接:http://codeforces.com/contest/558/problem/E E. A Simple Task time limit per test5 seconds memor ...
- 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 ...
随机推荐
- 新浪微博 iOS SDK获得用户信息
代码 - (void)getUserInfo { NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:2 ...
- c# 与 winform 界面开发
在 windows 下使用 vs2010 开发,未深入研究. c# 与 .net 开发,一堆又一堆的新名词,头晕目眩,比如 CLR / apartments / STA / MTA / COM 吐槽无 ...
- (转)IOS开发之——绘图(CGContext)
周刊 更多 登录 IOS开发之——绘图(CGContext) 时间 2014-04-21 09:17:43 CSDN博客 原文 http://blog.csdn.net/zhenyu521131 ...
- SQL Join 的三种类型
1.Hash Match Join Hash运算(即散列算法) 和Hash表. Hash运算是一种编程技术,用来把数据转换为符号形式,使数据可以更容易更快速地被检索.例如,表中的一行数据,可以通过程序 ...
- 利用Linux系统生成随机密码的10种方法
Linux操作系统的一大优点是对于同样一件事情,你可以使用高达数百种方法来实现它.例如,你可以通过数十种方法来生成随机密码.本文将介绍生成随机密码的十种方法. 1. 使用SHA算法来加密日期,并输出结 ...
- input表单
submit:点击submit按钮表单就会被提交给服务器,中文IE下默认按钮文本为“提交查询”,可以设置value属性修改按钮的显示文本 text:size属性为宽度,value为值,maxlengt ...
- centos VM 识别U盘
在VM设置选项中,选择 USB Controller 选项,设置相关参数即可
- jquery中onclick="fn"中$(this)所代表的对象
jquery中onclick="fn"中$(this)所代表的对象 js方法 function qiehuan(){ var src = $(this).attr("da ...
- html网页音乐播放器自带播放列表
基于网页的音乐播放器demo http://pan.baidu.com/s/1dDgm7HR 自己diy了一个手机端在线音乐播放器演示地址http://shanxi2014.com/zhuandiz ...
- 在Yii2.0中实现计划任务(cron)
以下由我们在信易网络公司开发项目的时候终结出的一些经验 Create console application 创建命令行应用 In advance template there is already ...