Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. int n, iloczyn=1, p=1, a[100000];
  10. int x, y, z;
  11. cin>>n;
  12.  
  13. a[0]=1;
  14. for(int i=2; i<=n; i++)
  15. {
  16. if(n%i==0
  17. )
  18. {
  19. a[p]=i;
  20. p++;
  21. n=n/i;
  22.  
  23. if(n%i==0)
  24. {
  25. while(n%i==0)
  26. {
  27. a[p+1]=i;
  28. p++;
  29. n=n/i;
  30. // cout<<i<<endl;
  31. iloczyn=iloczyn*i;
  32. }
  33. }
  34. iloczyn=iloczyn*i;
  35. }
  36. if(iloczyn==n)
  37. break;
  38. }
  39. //cout<<p<<endl;
  40. sort(a, a+p);
  41. for (int j=0; j<p&&p>3;j++)
  42. {
  43. a[j+1]=a[j]*a[j+1];
  44. p--;
  45. sort(a+p-2, a+p);
  46. }
  47. for(int x=0; x<a[2];x++)
  48. {
  49. cout<<"A";}
  50. for(int x=0; x<a[1];x++)
  51. {
  52. cout<<"B";}
  53. for(int x=0; x<a[0];x++)
  54. {
  55. cout<<"C";}
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement