aboutsummaryrefslogtreecommitdiff
path: root/Flipping_bits.cpp
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-04-30 01:13:40 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-04-30 01:13:40 +0200
commita0d7b8320a8996eee0ed957b79c3a882f8b47146 (patch)
tree76242ae2b19bad00796ed6d0104da8a0e4a99abe /Flipping_bits.cpp
downloadcompetitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.tar.xz
competitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.zip
Added all current problems
Diffstat (limited to 'Flipping_bits.cpp')
-rw-r--r--Flipping_bits.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Flipping_bits.cpp b/Flipping_bits.cpp
new file mode 100644
index 0000000..e06235b
--- /dev/null
+++ b/Flipping_bits.cpp
@@ -0,0 +1,16 @@
+#include<bits/stdc++.h>
+
+
+using namespace std;
+
+int main(){
+ int n, x=pow(2, 31) - 1;
+ cin >> n;
+ cout << n ^ x;
+ // 0 0 -> 1 -> 0
+ // 1 1 -> 0 -> 1
+ // 1 1 -> 0 -> 1
+ // 1 1 -> 0 -> 0
+
+ return 0;
+}