#include <iostream>
using namespace std;
int main()
{
long long x;
while(cin>>x)
{
if(x==0) break;
cout<<x<<" = ";
if(x<0)
{
cout<<" -1 x";
x=-1*x;
}
for(int i=2;i*i<=x+1;i++)
{
while(x%i==0&&x!=i)
{
cout<<" "<<i<<" x";
x=x/i;
}
}
if(x!=1) cout<<" "<<x<<'\n';
}
return 0;
}
一直TLE 不知怎樣可以更快??
prime table
http://www.csie.ntnu.edu.tw/~u91029/Prime.html