AcWing 867. 分解质因数
原题链接
简单
作者:
最后五分钟
,
2024-04-05 02:26:58
,
所有人可见
,
阅读 4
#include<bits/stdc++.h>
#define LL long long
#define x first
#define y second
#define de(x) cout<<#x<<" = "<<x<<" "
#define deg(x) cout<<#x<<" = "<<x<<endl
using namespace std;
const int N=10010,M=10010;
typedef pair<int,int> PII;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
while(n--)
{
int a;
cin>>a;
for(int i=2;i<=a/i;i++)
{
int t=0;
while(a%i==0)t++,a/=i;
if(t)cout<<i<<" "<<t<<endl;
}
if(a>1)cout<<a<<" "<<1<<endl;
cout<<endl;
}
return 0;
}