Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<cmath>
- using namespace std;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int n, iloczyn=1, p=1, a[100000];
- int x, y, z;
- cin>>n;
- a[0]=1;
- for(int i=2; i<=n; i++)
- {
- if(n%i==0
- )
- {
- a[p]=i;
- p++;
- n=n/i;
- if(n%i==0)
- {
- while(n%i==0)
- {
- a[p+1]=i;
- p++;
- n=n/i;
- // cout<<i<<endl;
- iloczyn=iloczyn*i;
- }
- }
- iloczyn=iloczyn*i;
- }
- if(iloczyn==n)
- break;
- }
- //cout<<p<<endl;
- sort(a, a+p);
- for (int j=0; j<p&&p>3;j++)
- {
- a[j+1]=a[j]*a[j+1];
- p--;
- sort(a+p-2, a+p);
- }
- for(int x=0; x<a[2];x++)
- {
- cout<<"A";}
- for(int x=0; x<a[1];x++)
- {
- cout<<"B";}
- for(int x=0; x<a[0];x++)
- {
- cout<<"C";}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement