HDU--1164
2015-06-13 09:20
232 查看
Eddy's research I
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7402 Accepted Submission(s): 4479
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
11
9412
Sample Output
11
2*2*13*181
Author
eddy
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { for (int i=2; i<=n; i++) { if (n %i==0) { n = n/i; if (n==1) cout << i<< endl; else cout << i<< "*"; i= 1; } } } return 0; }
相关文章推荐
- 日期格式化
- arduino小车入门教学——第四天(传感器)
- LeetCode192:House Robber
- Fabric批量远程执行操作
- HDU--1164
- iOS 音乐类App必备功能:后台播放、锁屏封面、远程播放控制
- Python模块学习笔记— —hashlib
- Hadoop安装
- Python学习十二:高阶函数
- 糊糊论道--谈谈变与不变和树下悟道的事情
- 并发编程实践五:ReentrantLock
- 通知(广播)传值
- Android string.xml 特殊字符
- Invert Binary Tree
- C#基本打印事件用法实例
- Ogre参考手册(一)2 核心对象
- php中的插件机制原理和实例
- unix C++网络编程
- 企业是否需要使用响应式网站
- Ubuntu14.04安装wineqq国际版