HDU 1164 Eddy's research I
来源:互联网 发布:京东网络促销活动对象 编辑:程序博客网 时间:2024/06/07 07:08
Eddy's research I
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5098 Accepted Submission(s): 3056
Problem Description
Eddy's interest is very extensive, recently he is interested in prime number. Eddy discover the all number owned can be divided into the multiply of prime number, but he can't write program, so Eddy has to ask intelligent you to help him, he asks you to write a program which can do the number to divided into the multiply of prime number factor .
Input
The input will contain a number 1 < x<= 65535 per line representing the number of elements of the set.
Output
You have to print a line in the output for each entry with the answer to the previous question.
Sample Input
119412
Sample Output
112*2*13*181
Author
eddy
Recommend
JGShining
将一个数分解成一个素数相乘的形式
#include<iostream>#include<cstring>using namespace std;int main(){ int n; int a[65536]; int b[100]; int i,j,k; memset(a,0,sizeof(a)); a[0]=a[1]=1; for(i=2;i<65536;i++) { if(!a[i]) for(j=i*2;j<65536;j+=i) a[j]=1; } while(cin>>n) { for(i=2,k=0;i<65536&&n;) { if(!a[i]) { if(n%i==0) { b[k++]=i; n/=i; i=2; } else i++; } else i++; } for(i=0;i<k;i++) if(i==k-1) cout<<b[i]<<endl; else cout<<b[i]<<"*"; } return 0;}
- HDU 1164 Eddy's research I
- HDU 1164 Eddy's research I
- hdu 1164 Eddy's research I
- HDU 1164 Eddy's research I
- hdu 1164 Eddy's research I
- Hdu 1164-Eddy's research I
- hdu(1164)Eddy's research I
- HDU 1164 Eddy's research I
- hdu 1164 Eddy's research I
- hdu 1164 Eddy's research I
- HDU 1164 Eddy's research I
- hdu 1164 Eddy's research I
- hdu-1164-Eddy's research I
- hdu-oj 1164 Eddy's research I
- hdu 1164 Eddy's research I
- HDU 1164 Eddy's research I.doc
- hdu 1164 Eddy's research I
- HDU 1164 Eddy's research I
- 利用SetupAPI实现遍历设备管理器
- android 如何实现附加现有数据库?而不是每次安装的时候都创建
- or改写为union all性能提升n倍
- Java String.split()用法小结(转)
- Linux 性能监测工具
- HDU 1164 Eddy's research I
- dsPIC33F串口接收到的数据立即返送-UART
- Holmos自动化测试入门学习(九)------用新开浏览器方式后页面元素的操作
- Spring - 装配Bean:即依赖注入
- Mac 中android SDK Manager无法更新的解决办法
- 动态库导出类-----practice
- Linux 性能监测:介绍
- 【读书笔记】usOS-II学习笔记(2008-11-3)
- 大话设计模式之单例模式