exponenciacion binaria
C++
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
//complexity O(log k)
ull po(ull n,ull k){
ull x=1;
while(k){
if(k&1)
x*=n;
n*=n;
k>>=1;
}
return x;
}
int main(){
ull n,m;
//n^m
cin>>n>>m;
cout<<po(n,m);
return 0;
}
Also in C++:
- Title
- binary tree deletion
- Category
- C++
- Title
- c++ string to stream
- Category
- C++
- Title
- compile c++ linux
- Category
- C++
- Title
- namespaces c++
- Category
- C++
- Title
- min coin change problem dp
- Category
- C++
- Title
- c++ initialize a vector
- Category
- C++
- Title
- c++ function to find minimum element in array
- Category
- C++
- Title
- object reference not set to an instance of an object c#
- Category
- C++
- Title
- iterate const vector
- Category
- C++
- Title
- shuffle vector c++
- Category
- C++
- Title
- error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(s[i] != "b"){
- Category
- C++
- Title
- power in c++
- Category
- C++
- Title
- c++ create object
- Category
- C++
- Title
- how to pass an object by reference in c++
- Category
- C++
- Title
- pair in c++
- Category
- C++
- Title
- free or delete in c++
- Category
- C++
- Title
- how to include seld declared header file in c++
- Category
- C++
- Title
- getting a random letter in c++
- Category
- C++
- Title
- matrix eigen c++ example
- Category
- C++
- Title
- create a dictionary cpp
- Category
- C++
- Title
- file objects in c++
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- transpose matrix eigen c++
- Category
- C++
- Title
- length of string c++
- Category
- C++
- Title
- insert elements in array in c++11
- Category
- C++
- Title
- declaring 2d vector in c++
- Category
- C++
- Title
- how to run a c++ program in the background
- Category
- C++
- Title
- c++ overloaded == operator
- Category
- C++
- Title
- passing a vector to a function c++
- Category
- C++
- Title
- std::iomanip c++
- Category
- C++
- Title
- check if intent has extras
- Category
- C++
- Title
- array search c++
- Category
- C++
- Title
- c++ clear console
- Category
- C++
- Title
- how the theam are store in database
- Category
- C++
- Title
- prims c++
- Category
- C++
- Title
- sort function in c++
- Category
- C++
- Title
- how to check type in c++
- Category
- C++
- Title
- mark occurances of elements in array cpp
- Category
- C++
- Title
- min heap priority queue c++
- Category
- C++
- Title
- c++ ternary operator
- Category
- C++
- Title
- opperanf >> c++
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- c++ replace n substrings
- Category
- C++
- Title
- how to grab all of user input c++
- Category
- C++
- Title
- command line options in c++
- Category
- C++
- Title
- how to find hcf in c++
- Category
- C++
- Title
- lisy stl C++
- Category
- C++
- Title
- count function c++
- Category
- C++
- Title
- c++ reset stream
- Category
- C++
- Title
- UPARAM(ref)
- Category
- C++
- Title
- multiple words C++ in same
- Category
- C++
- Title
- sqrt in c++
- Category
- C++
- Title
- memset c++
- Category
- C++
- Title
- c++ enum rand
- Category
- C++
- Title
- cout console
- Category
- C++
- Title
- how print fload wiht 3 decimal in c++
- Category
- C++
- Title
- Temporary file using MSFT API in cpp
- Category
- C++
- Title
- count number of zeros in array in O(logN)
- Category
- C++
- Title
- how to print for limited decimal values in c++
- Category
- C++
- Title
- range based for loop c++
- Category
- C++
- Title
- c++ reverse vector
- Category
- C++
- Title
- max element in array c++ stl
- Category
- C++
- Title
- how to make string get spaces c++
- Category
- C++
- Title
- find height of a tree
- Category
- C++
- Title
- properties of a set c++
- Category
- C++
- Title
- c++ constructor
- Category
- C++
- Title
- c++ string to integer without stoi
- Category
- C++
- Title
- reverse in vector c++
- Category
- C++
- Title
- dijkstra c++ geeksforgeeks using set
- Category
- C++
- Title
- qt make widget ignore mouse events
- Category
- C++
- Title
- how to iterate through array in c++
- Category
- C++
- Title
- C++ remove element from set
- Category
- C++
- Title
- function template
- Category
- C++
- Title
- arduino delay millis
- Category
- C++
- Title
- c++ typedef
- Category
- C++
- Title
- Operator overloading in C++ Programming
- Category
- C++
- Title
- c++ find prime numbers
- Category
- C++
- Title
- delete a double pointer c++
- Category
- C++
- Title
- c++ class constructor
- Category
- C++
- Title
- c++ clear stream
- Category
- C++
- Title
- Find the minimum difference between pairs in a simple path of tree C++
- Category
- C++
- Title
- C++ Syntax
- Category
- C++
- Title
- maximum subarray sum in c++
- Category
- C++
- Title
- monotonic deque
- Category
- C++
- Title
- 1d fixed length arrays c++
- Category
- C++
- Title
- clear file before writing c++
- Category
- C++
- Title
- convert int to binary string c++
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- Insert into vector C++
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- inheritance protected in c++
- Category
- C++
- Title
- linkedlist implementation in c++
- Category
- C++
- Title
- simple timer arduino blynk library error
- Category
- C++
- Title
- how to make a n*n 2d dynamic array in c++
- Category
- C++
- Title
- mao two drivers c++
- Category
- C++
- Title
- c++ vector
- Category
- C++
- Title
- *max_element in c++
- Category
- C++
- Title
- flake8 max line length
- Category
- C++
- Title
- residuo en lenguaje c
- Category
- C++
- Title
- tuple c++
- Category
- C++