Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long long int solutie(int putere)
  5. {
  6. long long int solutie=3;
  7. long long int R=1;
  8. while(putere)
  9. {
  10. if(putere%2==1)
  11. R*=solutie;
  12. solutie*=solutie;
  13. putere/=2;
  14. }
  15. return R;
  16. }
  17.  
  18. int main()
  19. {
  20. int n;
  21. cin>>n;
  22. int putere=n*(n-1)/2;
  23. cout<<solutie(putere);
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement