跳到正文

题解

题解:CF2025B Binomial Coefficients, Kind Of

NAJL约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年10月28日
收录
2026年11月14日
更新
2026年11月14日
篇幅
约 1 分钟
题目
CF2025B

版本

  1. v1当前

打表

1
11
121
1241
12481
1248161
124816321

显然c[i][j]=2^j(列从0序开始) 数据有点大,快速幂(递归) 自己看,

C++
#include<bits/stdc++.h>
using namespace std;
int a,b, sets;
const int mod=1000000007;
int ksm(int x, long long y) {
	if (y == 0) {
		return 1;
	}
	if (y == 1) {
		return x % mod;
	}
	int temp = ksm(x, y >> 1);
	temp = (long long)temp * temp % mod;
	if (y & 1) {
		temp = (long long)temp * x % mod;
	}
	return temp;
}
void solve(){
	for(int i=0;i<sets;i++){
		cin>>a;
	}
	for(int i=0;i<sets;i++){
		cin>>b;
		cout<<ksm(2,b)<<endl;
	}
}
int main() {
	
	cin>>sets;
	solve();
	return 0;
}
原文