Count K-Subsequences of a String with Maximum Beauty Solution || Leetcode Bi-Weekly 112 Get link Facebook X Pinterest Email Other Apps - September 04, 2023 Count K-Subsequences of a String with Maximum Beauty Get link Facebook X Pinterest Email Other Apps
Reduce to 1 Solution || Codechef Starters - 36 Get link Facebook X Pinterest Email Other Apps - April 27, 2022 Reduce to 1 Solution Codechef Starters - 36Problem Code : RED1Problem Link : https://www.codechef.com/START36D/problems/RED1Solution :#include <bits/stdc++.h>#define ll long long intusing namespace std;int main(){ ll t = 1; cin >> t; while (t--) { ll n; cin >> n; if (n % 2 == 1) { if (n != 1) cout << 1 << "\n"; else cout << 0 << "\n"; } else { map<ll, ll> mp; ll temp = n; while (temp % 2 == 0) { mp[2]++; temp /= 2; } bool ok = true; ll ans = 0; if (mp[2] % 2 == 1) { ok = false; } else { if (sqrt(temp) == floor(sqrt(temp))) { ans = 1; } else { ans = 2; } } cout << (ok ? ans : -1) << "\n"; } }} Get link Facebook X Pinterest Email Other Apps Comments
Exact Marks Solution || Codechef March Long Challenge 2022 - I - March 11, 2022 Exact Marks Solution Read more
Substring of a Substring Solution || Codechef March Long Challenge 2022 - I - March 11, 2022 Substring of a Substring Solution Read more
Binary Base Basics Solution || Codechef February Long Challenge 2022 - I - February 04, 2022 Binary Base Basics Solution Read more
Comments
Post a Comment