武大校赛 D Deploy the medical team
Deploy the medical team
https://ac.nowcoder.com/acm/contest/5523/D
Solution
题意: 个人, 其中有
个可以做
, 必须要有一个
组合数学, 从 个人里找一个做
, 剩下的任选
即
于是
Code
/*
autor: Kurisu
2020年4月26日16:30:19
*/
#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int N = 1e5 + 5;
const double eps = 1e-10;
const int mod = 1e9 + 7;
typedef long long ll;
ll qpow(ll a, ll b) {
ll res = 1;
while(b) {
if(b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
int main() {
int t;
cin >> t;
while(t--) {
ll n, m;
cin >> n >> m;
cout << m * qpow(2, n - 1) % mod << "\n";
}
return 0;
}
联想公司福利 1481人发布