Codeforces|Leetcode|Codechef free solutions
Відкрити в Telegram
Free codeforces, Codechef, Leetcode solutions are available 😍😍😍😍😍😍 Helped More than 200+ students to crack coding round in 2022 and helped placed them in Good companies. 🥳🥳🥳🤩🤩🤩 Dm @Cpsoln if you want help in coding round.
Показати більше4 317
Підписники
Немає даних24 години
-137 днів
-5230 день
Архів дописів
Anyone who is a good AI developer
Dm @Cpsoln
The work will be paid.
Please dm only if you are genuine AI developer.
TCS is back with TCS National Qualifier Test (TCS NQT)
Eligibility Criteria: 2024 grads only (B.E, B.TECH, M.E, M.TECH, MCA, M.Sc, MS)
Roles
1) Ninja (3.36 LPA)
2) Digital (7 LPA)
3) Prime (9 LPA)
Link to apply:https://shorturl.at/adwW5
Hack with infy only 3 remaining slots.
Pay and book your slot fast.
Dm @Cpsoln fast.
Jp Morgan code for good slots available
Dm @Cpsoln fast
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
int power(int a, int b) {
int result = 1;
while (b > 0) {
if (b & 1) {
result = (result * a) % MOD;
}
a = (a * a) % MOD;
b >>= 1;
}
return result;
}
string intToBin(int n) {
string x = "";
while (n != 0) {
if (n & 1) {
x += '1';
} else {
x += '0';
}
n >>= 1;
}
reverse(x.begin(), x.end());
return x;
}
void solve() {
int x;
cin >> x;
string binStr = intToBin(x);
string hue = "11";
int ptr = 0;
int pos = 0;
for (int i = 0; i < binStr.length(); i++) {
if (binStr[i] == hue[ptr]) {
ptr++;
if (ptr == 2) {
pos = i + 1;
break;
}
}
}
if (ptr <= 1) {
cout << 1 << endl;
return;
}
int cnt = 0;
for (int i = pos; i < binStr.length(); i++) {
if (binStr[i] == '0') {
cnt++;
}
}
cout << power(2, cnt) << endl;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
for (int testCase = 0; testCase < t; testCase++) {
solve();
}
return 0;
}
