HDU 1405 The Last Practice
The Last Practice
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9226 Accepted Submission(s): 1960
We
have been training for 45 days, and all guys must be tired.But , you
are so lucky comparing with many excellent boys who have no chance to
attend the Province-Final.
Now, your task is relaxing yourself
and making the last practice. I guess that at least there are 2 problems
which are easier than this problem.
what does this problem describe?
Give you a positive integer, please split it to some prime numbers, and you can got it through sample input and sample output.
file contains multiple test case, each case consists of a positive
integer n(1<n<65536), one per line. a negative terminates the
input, and it should not to be processed.
each test case you should output its factor as sample output (prime
factor must come forth ascending ), there is a blank line between
outputs.
60=2^2*3^1*5^1
#include <cstdio> int main()
{
int n,cn = ;
while(scanf("%d",&n), n>){
if(cn != )
printf("\n");
printf("Case %d.\n",++cn);
for(int i = ; i*i <= n; ++i){
int cnt = ;
while(n%i == ){
++cnt;
n /= i;
}
if(cnt != )
printf("%d %d ",i,cnt);
}
if(n>)
printf("%d 1 ",n);
printf("\n");
}
return ;
}
HDU 1405 The Last Practice的更多相关文章
- HDU 1405 The Last Practice 数学水题
http://acm.hdu.edu.cn/showproblem.php?pid=1405 题目大意: 给你一个数,让你分解素因子,输出它的各次幂. 如60 输出:2 2 3 1 5 1 (60=2 ...
- HDU 1405 第六周 J题
Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all ...
- hdoj 1405 The Last Practice
The Last Practice Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- HDU 1405
题意: 输入一个数n,输出它的素因子与这个素因子出现的次数. 分析: 用欧拉函数,变下形就好了,不再过多解释. 代码如下: #include <iostream> #include < ...
- hdu 1096 A+B for Input-Output Practice (VIII)
A+B for Input-Output Practice (VIII) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3 ...
- hdu 1095 A+B for Input-Output Practice (VII)
A+B for Input-Output Practice (VII) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32 ...
- hdu 1094 A+B for Input-Output Practice (VI)
A+B for Input-Output Practice (VI) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/327 ...
- hdu 1093 A+B for Input-Output Practice (V)
A+B for Input-Output Practice (V) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3276 ...
- hdu 1092 A+B for Input-Output Practice (IV)
A+B for Input-Output Practice (IV) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/327 ...
随机推荐
- oracle 导入报错 ORA-00959: tablespace 'HB' does not exist
导入oracle 时发现有几张表导入时一直报错: 报错信息:IMP-00003: ORACLE error 959 encountered ORA-00959: tablespace 'HB' d ...
- keystone命令与client接口学习
keystone学习 ------------------ Keystone(OpenStack Identity Service)是OpenStack框架中,负责身份验证.服务规则和服务令牌的功能, ...
- div蒙版+可移动
<html> <head> <title></title> <script src="jquery-1.8.2.js&q ...
- Sql之表的连接总结
1.交叉连接(就是将两张表的数据 交叉组合在一起) 有两张表 客户表:[Sales.Customers] 和订单表:[Sales.Orders]. 业务需求:实现 Customer中custid(客户 ...
- Jquery实现自动提示下拉框
1.引入脚本库: <script type="text/javascript" src="/Jscripts/jquery-1.3.2.js"&g ...
- (转)深入理解SP、LR和PC
网址:http://blog.csdn.net/zhou1232006/article/details/6149548 深入理解ARM的这三个寄存器,对编程以及操作系统的移植都有很大的裨益. 1.堆栈 ...
- 把Ubuntu打造成Mac Macbuntu
Macbuntu:把 Ubuntu 一键打造成完整的 Mac 风格 23八 2010 # 作者:riku/ 本文采用CC BY-NC-SA 2.5协议授权,转载请注明本文链接. Macbuntu 是一 ...
- NOSQL Mongo入门学习笔记 - MongoDB的安装(一)
手上的工作不是很忙,所以来学习学习很久就像接触的MongoDb,无奈前段时间工作时间都比较多.记录在这里供以后参考 环境: Centos 7 64位 开始: 1. 在官网下载Mongo : wget ...
- HTTP POST GET 区别
一 原理区别 一般在浏览器中输入网址访问资源都是通过GET方式:在FORM提交中,可以通过Method指定提交方式为GET或者POST,默认为GET提交 Http定义了与服务器交互的不同方法,最基本的 ...
- Visual C++ 6.0静态、动态链接库
1.什么是静态连接库,什么是动态链接库 静态链接库与动态链接库都是共享代码的方式,如果采用静态链接库,则无论你愿不愿意,lib 中的指令都全部被直接包含在最终生成的 EXE 文件中了 ...