C-factorization factor crawling in Process ... crawling Failed time Limit: 2000ms Memory Limit: 10240kb 64bit IO Format: % LLD &%llu
Submit Status
Description
Suppose X is a positive integer whose value is not more than 65535 (that is, 1< x < =65535), write a program that
Decomposes x into multiples of a number of primes.
Input
The first line of the input contains a positive integer k (1<=k<=10), which indicates the number of test cases followed by the K line,
Each row corresponds to a test example that contains a positive integer x.
Output
Each test example corresponds to a row of output, the prime number of the output of the product expression, the prime number from small to large array,
The multiplication is represented by "*" Between two primes.
Sample Input
2 9828
Sample Output
2*2*3*3*3*7*13
Note: Has been overrun, almost collapsed, can optimize all the thought, but after all, is slag, finally Baidu
Although do not understand, but the magic of the discovery is very useful,,, and read a few times learned, I-- ,
Genius Ah, must keep!!
#include <stdio.h>intMain () {intN,i,j,a; scanf ("%d",&N); while(n--) {scanf ("%d",&a); if(a==1) printf ("1"); for(i=2; i<=a;i++) { if(a%i==0) {printf ("%d", i); if(i!=a) printf ("*"); A/=i; I--; } } if(a!=1) printf ("%d", a); printf ("\ n"); }}
"Small Method-The simplest" C-factorization factor