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 ...
随机推荐
- EXTJS 4.2 资料 控件之 Store 用法
最近工作,发现在Extjs中自定义Store的功能挺多,特意在此做笔记,几下来,具体代码如下: 1.定义Store //定义Store var ItemSelectorStore = new Ext. ...
- iOS 进阶 第一天(0323)
0323 Storyboard连线错误 如下图: 不允许直接修改对象的结构体属性成员,但允许直接整体修改对象的结构体属性 如下图: 打印一个控件对象的frame 如下图: 如果一个控件无论怎么改变它的 ...
- AOP和IOC个人理解
14:18 2014/5/5 IOC inversion of control 控制反转 将new对象的权力由调用者转移到spring容器(即xml文件),Struts2与Spring整合(scop ...
- hdu 4722 Good Numbers(规律题)
http://acm.hdu.edu.cn/showproblem.php?pid=4722 [题意]: 找GoodNumbers一个数N,如果它每一个位数字之和可以整除10,那么它就是GoodNum ...
- Delphi XE5 android 捕获几个事件
以下代码能监控到以下几个事件: FinishedLaunching BecameActive WillBecomeInactive EnteredBackground Wi ...
- Extjs4.2——Panel
一.Panel的border属性: 示例: Ext.create('Ext.panel.Panel', { title: 'Hello', width: 200, height:100, border ...
- jquery.dragsort实现列表拖曳、排序
在一次工作中需要将功能模块实现拖曳并且排序,并且将排序结果保存到数据库,用户下次登录后直接读取数据库排序信息进行显示.LZ找了好多插件,最后发现 jquery.dragsort 这款插件是最好使用的, ...
- uva 10271
DP 状态转移方程 dp[i][j] = min(dp[i-1][j], dp[i-2][j-1] + w)) dp[i][j] 指的是前i个筷子组成j组所花费的最小值 考虑第i个筷子是否参与第j组 ...
- HDU4714+三分
题意:给定N个点,每个点有初始位置和初始速度. 问:在哪个时刻 使得所有的点的最大距离值最小. 分析:一开始枚举两两之间的最大值,然后在最大值中求一个最小值...(WA:题意严重理解不清..) 由两点 ...
- linux samba.tar.gz安装和配置
安装步骤: 1. tar -xzvf samba-3.5.10.tar.gz2. cd samba-3.5.103. cd source34. ./autogen.sh 如果出现:./autogen ...