2 solutions

  • 0
    @ 2024-11-30 11:23:19
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        cout<<n<<"=";
        int i=2;
        while(n!=1)
        {
            bool temp=true;
            while(temp)
            {
                if(n%i==0)
                {
                    cout<<i;
                    n/=i;
                    if(n!=1) cout<<"*";
                }
                else temp=false;
            }
            i++;
        }
    }
    

    Information

    ID
    56
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    (None)
    # Submissions
    175
    Accepted
    50
    Uploaded By