aboutsummaryrefslogtreecommitdiff
path: root/codechef/jogging/main.cpp
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2022-06-29 15:57:29 +0200
committeromagdy7 <omar.professional8777@gmail.com>2022-06-29 15:57:29 +0200
commit1b8f7c9d4eb8b767d32dbbbfd96662b73c037627 (patch)
tree7f984139dcca441d7ab582e0c67daa125e400a14 /codechef/jogging/main.cpp
parent7860cb994fbf6af63865eb6dc9045bbc8abd61a4 (diff)
downloadcompetitive-programming-1b8f7c9d4eb8b767d32dbbbfd96662b73c037627.tar.xz
competitive-programming-1b8f7c9d4eb8b767d32dbbbfd96662b73c037627.zip
Solved some problem from codechef and codeforces
Diffstat (limited to 'codechef/jogging/main.cpp')
-rw-r--r--codechef/jogging/main.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/codechef/jogging/main.cpp b/codechef/jogging/main.cpp
new file mode 100644
index 0000000..e28bc48
--- /dev/null
+++ b/codechef/jogging/main.cpp
@@ -0,0 +1,31 @@
+#include<bits/stdc++.h>
+
+
+using namespace std;
+
+#define MOD 1000000007
+
+long long power(long long b, int p) {
+ long long res = 1;
+ while(p) {
+ if(p % 2) res = (res * b) % MOD;
+ b = (b * b) % MOD;
+ p /= 2;
+ }
+ return res;
+}
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while(tt--){
+ int n;
+ int x;
+ cin >> n >> x;
+ long long y = power(2 ,n - 1);
+ long long ans = (x * y) % MOD;
+ cout << ans << endl;
+ }
+}