4 solutions

  • -1
    @ 2024-12-21 11:47:19
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        while(n--)
        {
            int x;
            cin>>x;
            map<int,int> h;
            for(int i=2;i<x/i;i++)
            {
                while(x%i==0)
                {
                    h[i]++;
                    x/=i;
                }
            }
            if(x>1)
            {
                h[x]++;
            }
            for(auto it:h)
            {
            	cout<<it.first<<" "<<it.second<<endl;
    		}
    		cout<<endl;
        }
        return 0;
    }
    

    Information

    ID
    178
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    99
    Accepted
    21
    Uploaded By