http://acm.hdu.edu.cn/showproblem.php?pid=1164
题目比较水,但是还是发现一些小问题 ;细节。。注重细节
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std ;
#define INT __int64
bool judge( INT n )
{
for( INT i = 2 ; i <= sqrt((double) n ) ; i++ )
if( n % i == 0 )
return false ;
return true ;
}
int main()
{
INT n ;
while( cin >> n )
{
if( judge( n ) )
cout << n << endl ;
else
{
INT i = 2 ;
while( i <= sqrt( ( double ) n ) )
{
if( n % i == 0 )
{
cout << i << "*" ;
n /= i ;
i = 2 ;
}
else
++i;
}
cout << n << endl ;
}
}
return 0 ;
}