SRM 605 div 2 T3
2024-08-29 00:14:04
#include <bits/stdc++.h>
#define Mo 1000000007
#define MAXN 50
#define MAXK 10
using namespace std;
int dp[*MAXN+][<<MAXK];
class AlienAndSetDiv2 {
public:
int N, K;
int calc(int n, int unmatched)
{
int res = ;
if (- != dp[n][unmatched]) {
return dp[n][unmatched];
} if (n == * N + ) {
if ( == unmatched) {
res = ;
}
} else {
if ( == unmatched) {
res += ( * calc(n + , ) ) % Mo;
} else {
int newset = unmatched;
int i = ;
for (i = ; (newset & 0x80000000 ) == ; newset = ( newset << ), ++i) {
}
int mx = - i;
res += calc(n + , (unmatched - ( << mx)) << );
res %= Mo; if (mx != K - ) {
newset = unmatched;
newset = ( (newset << ) | );
res += calc(n + , newset);
res %= Mo;
}
}
}
dp[n][unmatched] = res;
return res;
}
最新文章
- java.lang.NoClassDefFoundError: Lorg/slf4j/Logger;
- java 多线程(wait/notify/notifyall)
- 在移动端如何选择字体大小和布局的单位,px或dp?
- ASIO插件 真的能提升 音质?(听音乐者必看)
- Linux open函数
- 无法定位序数XX于动态链接库XX.dll的解决的方法
- 教你Mac OS系统四种改动Hosts文件的方法
- TatukGIS - GisDefs - ChangeDir 函数
- 应用Oracle(解锁内置用户)
- mysql一个表中多个字段对应另一个表的id如何查询?
- [网络] SOCKET, TCP/UDP, HTTP, FTP
- asp.net 分页类
- winform无边框窗口拖动
- keeplived日志位置指定
- hihocoder #1159 : 扑克牌
- SpriteKit中节点的z-position
- 语音活性检测器py-webrtcvad安装使用
- 【C语言程序】让用户输入一句话,输出这句话中每个单词含有多少个字母
- java技术突破要点
- python学习 day19 configparser模块 os模块 subprocess模块