Advertisement
Josif_tepe

Untitled

Apr 18th, 2024
865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. ll power(ll a, ll b) {
  2.     ll res = 1;
  3.     while(b) {
  4.         if(b % 2 == 1) {
  5.             res *= a;
  6.         }
  7.         a *= a;
  8.         b /= 2;
  9.     }
  10.     return res;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement