Submission #577192

#TimeUsernameProblemLanguageResultExecution timeMemory
577192berrXORanges (eJOI19_xoranges)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int mod=1e9+7; int poww(int a, int b) { if(b==0) return 1; int tmp=poww(a, b/2); if(b%2==0) return (tmp*tmp)%mod; else return (((tmp*tmp)%mod)*a)%mod; } int sum(int a, int b) { return ((((a+b)%mod)+mod)%mod); } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin>>n>>k; n--; int ans=1; while(n>=0) { if(k%2==0) ans=sum(ans, poww(2, n)), k/=2; else k++, k/=2; n--; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...