Advertisement
Guest User

Problema 17

a guest
Nov 26th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int x, p=0;
  9. cin>>x;
  10. for(p=0;x%2==0;x/=2,p++);
  11. if(p>0)
  12. cout<<"2^"<<p<<endl;
  13. for(int d=3;d*d<=x;d+=2);
  14. {
  15. for(p=0;x%d==0;x/=2,p++);
  16. if(p>0)
  17. cout<<d<<"^"<<p<<endl;
  18. }
  19. if(x!=1)
  20. cout<<x<<"^";
  21. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement