Ideas : Divide the input number into n The result of multiplication of two primes , Store it in an array . And then output it

Eddy's research I

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 6633    Accepted Submission(s): 3971
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<stdio.h>
#include<string.h>
int a[55];
int getprime(int x)
{
memset(a,0,sizeof(a));
int i,cnt=0;
for(i=2; i<=x; i++)
{
while(x%i==0)
{
a[cnt++]=i;
x=x/i;
}
}
return cnt;
}
int main()
{
int n;
while(~scanf("%d",&n))
{
int k,i;
k=getprime(n);
for(i=0; i<k-1; i++)
printf("%d*",a[i]);
printf("%d\n",a[k-1]); }
return 0;
}

HDU 1164 Eddy&#39;s research I【 Prime screening 】 More articles about

  1. hdu 1165 Eddy&amp;#39;s research II( mathematical problem , Recurrence )

    // Eddy continue Problem Description As is known, Ackermann function plays an important role in the sphere ...

  2. HDU 2161 Primes ( Prime screening )

    The question : Enter a number to determine whether it is a prime number , Also stipulates 2 Not primes . Analysis : It's very simple , Prime screening , Note that the closing condition is n<0, In the beginning, it was cratered ... Don't say the , Go straight to the code : #include <iostrea ...

  3. POJ 3978 Primes( Prime screening )

    subject Simple calculation A,B How many primes are there between It's just that the test data is negative //AC //A and B How many primes are there between // The data may have negative !!! #include<string.h> #include< ...

  4. POJ 2689 Prime Distance ( Prime screening , Large interval screening )

    The question : Give an interval [L,U], Find out the nearest two prime numbers and the farthest two prime numbers in the interval . Prime screening . All less than U Number of numbers , If it's a sum , It must be a factor (2 To sqrt(U) Prime between ) Multiple . because sqrt(U) ...

  5. LightOJ 1259 Goldbach`s Conjecture ( Goldbach conjectures + Prime screening )

    http://lightoj.com/volume_showproblem.php?problem=1259 The main idea of the topic : Give you a number n, This number can be divided into two prime numbers a.b,n = a + b And a<=b, ask ...

  6. poj 2262 Goldbach&#39;s Conjecture( Prime screening )

    http://poj.org/problem?id=2262 Goldbach's Conjecture Time Limit: 1000MS   Memory Limit: 65536K Total ...

  7. HDU_2136—— Maximum prime factor , Prime screening

    Problem Description Everybody knows any number can be combined by the prime number. Now, your task i ...

  8. 51nod 1536 Different guessing games Ideas :O(n) Prime screening . Same as Codeforces 576A Vasya and Petya&#39;s Game.

    I don't say much nonsense , Let's start with the topic . 51nod Codeforces Two actually mean the same thing , see 51nod The title is very clear , The meaning of the title will not be repeated . Let's go straight to my analysis process : It's just a little tricky to get it at first , It seems very difficult , then ...... then ...

  9. PAT Answer to question a -1059. Prime Factors (25)- Prime screening

    The prime number screening method can be used . Range long int, In fact, the size range and int equally , At first I thought it meant long long, It's troublesome to think about how to do it . And now it's just int The scope of the , The difficulty level is different , In an instant, it becomes a water topic , because i ...

Random recommendation

  1. iOS UITableView Use ( selected from oschina)

    1. New chapter creation tableView   http://my.oschina.net/joanfen/blog/203041 2. The operation of the line in the advanced chapter list   http://my.oschina.net/jo ...

  2. use Maven newly build Web Wrong item times

    stay cmd Next , use mvn command mvn archetype:create -DgroupId=org.seckill -DartifactId=seckill -DarchetypeArtifactId=m ...

  3. different windows phone (47) - 8.0 Other : Lock screen information and lock screen background , Battery status , Multiresolution , The store , Built in protocol , Fast recovery

    [ Source download ] different windows phone (47) - 8.0 Other : Lock screen information and lock screen background , Battery status , Multiresolution , The store , Built in protocol , Fast recovery author :webabcd The introduction is different win ...

  4. promote web Application performance ( Two )

    Best practices This chapter will outline what can help you improve web Best practices for application performance . Reduce HTTP Number of requests Every HTTP Requests have overhead , Including finding DNS. Create a connection and wait for a response , So reducing the number of unnecessary requests can reduce unnecessary overhead ...

  5. 【 Reprint 】 Linux User mode and kernel mode

    [ explain ] Reprinted from  http://my.oschina.net/liubin/blog/27795 What is user mode , What is kernel state , These two basic concepts have not been understood very clearly before , The root cause, I think, is that most of ...

  6. angularjs Apply skeleton

    When using a typical class library , You can choose and use the features you like : And for angularjs Frame speaking , It has to be used as a complete suite , Everything in the frame is contained in it , Next we will introduce angular The basic module of , So you can ...

  7. Dungeon Master(poj 2251)

    Description You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is co ...

  8. POJ 2484 A Funny Game

    game . $n>=3$, The backhand wins , Or you win first . #pragma comment(linker, "/STACK:1024000000,1024000000") #include& ...

  9. java The byte array is formatted as a hexadecimal string

    /** * format byte * * @param b * @return */ public static String byte2hex(byte[] b) { char[] Digit = { ' ...

  10. ASP.NET MVC Case studies ( 6、 ... and )

    ASP.NET 6、 ... and A little problem We continue to improve “MVC Announcement system ”, This time, , Our requirement is to add logging capabilities to the announcement publishing function , Before the announcement , Record once , After the announcement is successful , Record it again . And then make it have exception handling , ...