Prime FactorDescription Give you a positive integer,please s

Prime Factor
Description
Give you a positive integer,please split it to some prime numbers,and you can got it through sample input and sample output.
Input
Input 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.
Output
For each test case you should output its factor as sample output (prime factor must come forth ascending ),after each number you should output a space.There is a blank line between outputs.
Sample Input
60
12
-1
Sample Output
Case 1.
2 2 3 1 5 1
Case 2.
2 2 3 1
Hint
60=2^2*3^1*5^1
Source
hdu
这个hint 我有点看不懂 那16的话是写成 2 2 2 2 还是2 4
#include
#include
#include
int main()
{
int num;
int g=0;
while(scanf("%d",&num)!=EOF) //特别注意这行的写法
{
int i,j,k,flag,h,p,temp,m,num2;
g=g+1;
p=num;
if(num
typqds 1年前 已收到1个回答 举报

sfyt2005 幼苗

共回答了21个问题采纳率:85.7% 举报

32=2^5;
16=2^4;
这个意思就是把其因式分解并写成幂的形式吧,并且因子是从小到大.

1年前

8
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.025 s. - webmaster@yulucn.com