Eddy ' s-I
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 7117 Accepted Submission (s): 4268
Problem Descriptioneddy ' s interest is very extensive, recently he's interested in prime number. Eddy Discover the all number owned can is divided into the multiply of prime number, but he can ' t write program, so EDD Y have to ask intelligent him, he asks you to write a program which can do the number to divided into the multi Ply of prime number factor.
Inputthe input would contain a number 1 < x<= 65535 per line representing the number of elements of the set.
Outputyou has 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
Authoreddy emphasis is on prime number determination
#include <iostream> #include <algorithm>using namespace Std;int prime[65536]={0}; int main () {for (int i=2;i<= (65535/2); i++) {int q;for (q=i+i;q<=65535;q+=i) prime[q]=1; } int Ls[10000];int n;int Gq[100];while (cin>>n) {int t=0;for (int j=2;j<=65535;j++) {if (!prime[j]&&! ( N%j)) {ls[t++]=j; N/=j;if (n==1) break; if (n<=j) j=1;} Sort (ls,ls+t); for (int k=0;k<t-1;k++) cout<<ls[k]<< "*"; cout<<ls[t-1]<<endl;} return 0;}
Hangzhou Electric HDU 1164 Eddy ' s