제출 #731759

#제출 시각아이디문제언어결과실행 시간메모리
731759AtabayRajabliRack (eJOI19_rack)C++11
40 / 100
1 ms320 KiB
#include <bits/stdc++.h> #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define MAX 5e4 + 1 #define all(v) v.begin(), v.end() #define sz(v) v.size() #define INF 0x3F3F3F3F3F3F3F3FLL #define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define sec second #define fi first typedef long long ll; typedef unsigned long long ull; using namespace std; int binpow(int a, int b, int c) { int res = 1; a%=c; while(b > 0) { if(b & 1) { res = res * a % c; } a = a * a % c; b >>= 1; } return res; } void $() { int n, k, mod = 1e9 + 7; cin >> n >> k; k--; int res = 0; while(k) { n--; if(k & 1) { res = (res + binpow(2, n, mod))%mod; } k >>= 1; } cout << res + 1 << endl; } int main() { OPT int t = 1; //cin >> t; while(t--) $(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...