重铸华农荣光 我辈义不容辞
The nineteenth day - prime factor
#include<iostream>
using namespace std;
void solve(int x)
{
for(int i=2;i<=x/i;i++)
{
int ans=0;
if(x%i==0)
{
while(x%i==0)
{
ans++;
x/=i;
}
cout<<i<<" "<<ans<<endl;
}
}
if(x>1) cout<<x<<" "<<1<<endl;
cout<<endl;
}
int main()
{
int n;
cin>>n;
while(n--){
int x;
cin>>x;
solve(x);
}
return 0;
}