Advertisement
STANAANDREY

power sda

Nov 10th, 2023
1,040
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. typedef unsigned long long ull;
  4.  
  5. ull pow(ull b, ull e) {
  6.     ull ans = 1;
  7.     while (e) {
  8.         if (e & 1) {
  9.             ans = ans * b;
  10.         }
  11.         b *= b;
  12.         e >>= 1;
  13.     }
  14.     return ans;
  15. }
  16.  
  17. int main(void) {
  18.     ull b, e;
  19.     scanf_s("%llu %llu", &b, &e);
  20.     printf("%llu", pow(b, e));
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement