이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define pi pair<ll,ll>
#define PI 3.1415926535897932384626433
const ll mod=1000000007,mod1=998244353,INF=1e18,MAX=1e9;
int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false);
ll n,k;
cin>>n>>k;
auto fastPow=[&](ll a,ll b) {
ll res=1;
while(b>0){
if(b%2==1){
res*=a;
res%=mod;
}
b/=2;
a=a*a%mod;
}
return res;
};
ll v=1;
ll ans=1;
while(v!=n+1){
if(k%2==0){
ans+=fastPow(2,n-v);
ans%=mod;
}
k=k/2+k%2;
v++;
}
cout<<ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |