- & - You can use it to check if a number is divisible by 2.
- ^ - This is the XOR operator. XOR has property : the same number XOR the same number equal to zero.
- 2 power n can be done in constant time with bit operation <<. Ex. (1<<n)
- Multiplication and division are slower then bit operations. (n >>= 1) is equivalent as n /= 2. (n <<= 1) is equivalent as n *= 2.
- the or bit operation
- n++ - increment n by 1
- n-- - subtracts n by 1
- ++n - increment n by 1
- --n - subtracts n by 1
- n%m = r - r is the remainder of the division n and m
- *, -, /, + - basic arithmetic operators
Tuesday 12 March 2019
Basic Operators
Today we will be talking about operations. There are many different types of operations :
Subscribe to:
Post Comments (Atom)
std::next_permutation(arr.begin(),arr.end());
What is next_permutation(a.begin(),a.end()) ? Next permutation is like what its name says, finds the next permutation of a and assigns ...
-
Usage of __int128_t: supports really big intermediate numbers, from -2^128 + 1 to 2^128 - 1 it has 128 bits Usage of __float128 : ...
-
Here are some extensions that I have found. Some of them are more useful than others. indexed set power(x,y) rope indexed set is j...
-
Method 1 : A noob's way : #include <iostream> using namespace std; int main(){ int nb,a; cin >>...
No comments:
Post a Comment