您的位置:首页 > 其它

【Hello 2018 A】 Modular Exponentiation

2018-01-09 09:49 232 查看

【链接】 我是链接,点我呀:)
【题意】


在这里输入题意

【题解】


当a<b的时候
a%b==a
显然2^n增长很快的。
当2^n>=1e8的时候,直接输出m就可以了

【代码】

#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll n,m;

int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n >> m;
//m%2^n
if (n>=32){
cout << m << endl;
}else{
ll now = 1;
for (int i = 1;i <= n;i++)
now = now*2;
cout << m%now<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: