#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <map> using namespace std;
const int MAX_A = ;
const int MAX_T = ;
int T, A, S, B;
int a[MAX_T];
int dp[][MAX_A];
const int MOD = 1e6; int main(void)
{
cin>>T>>A>>S>>B;
//输入组别的数量、蚂蚁的数量、起始的地方、终止的地方
int x;
for(int i = ; i < A; i++){
scanf("%d", &x); //组的编号其实是 0 到 T - 1
a[x-]++;
}
//UNIT OPTION
memset(dp, , sizeof(dp));
for(int i = ; i <= a[]; i++) dp[][i] = ;
// END OF INIT
for(int i = ; i < T; i++){
if(i & ){
memset(dp[], , sizeof(dp[]));
for(int j = ; j <= B; j++){
for(int k = ; k <= a[i] && k <= j; k++){
dp[][j] += dp[][j-k], dp[][j] %= MOD;
}
}
}
else{
memset(dp[], , sizeof(dp[]));
for(int j = ; j <= B; j++){
for(int k = ; k <= a[i] && k <= j; k++){
dp[][j] += dp[][j-k], dp[][j] %= MOD;
}
}
}
}
int res = ;
// printf("SHOW THE TMEP\n");
if((T - ) & ){
// for(int i = 0; i < S; i++) printf(" i %d : %d\n", i, dp[1][i]);
for(int i = S; i <= B; i++){
// printf(" i %d : %d\n", i, dp[1][i]);
res += dp[][i];
res %= MOD;
}
}
else{
// for(int i = 0; i < S; i++) printf(" i %d : %d\n", i, dp[0][i]);
for(int i = S; i <= B; i++){
// printf(" i %d : %d\n", i, dp[0][i]);
res += dp[][i];
res %= MOD;
}
}
// printf("THE RESULT : ");
printf("%d\n", res);
return ;
}

注意  剩余 后 6 位; 然后你需要 MOD 1E6; 并不是 1E7 !!!!!!!!

POJ3046ANT_COUNTING的更多相关文章

随机推荐

  1. DEVICE_ATTR设置设备属性

    DEVICE_ATTR设置设备属性 为了在sysfs下生成可控节点,方便上层调用. sysfs是一个基于RAM的文件系统,它和Kobject一起,可以将Kernel的数据结构导出到用户空间,以文件目录 ...

  2. VMWare Fusion 8 序列号

    FY75A-06W1M-H85PZ-0XP7T-MZ8E8 ZY7TK-A3D4N-08EUZ-TQN5E-XG2TF FG1MA-25Y1J-H857P-6MZZE-YZAZ6

  3. 自制 yum 源仓库

    转自:https://www.cnblogs.com/marility/p/7278374.html 背景 客户服务器为内网机器,centos7系统,且无法与外网连接.需要部署对应的LANMP环境及其 ...

  4. intellj idea 常用快捷键

    1.command+shift+a 查找操作2.command+e 查找历史打开的文件3.command+n 查找类4.command+shift+n 查找文件

  5. legend3---14、所有增删改的前置操作可以是什么

    legend3---14.所有增删改的前置操作可以是什么 一.总结 一句话总结: 先查询数据有没有,这样既起到了服务端验证的功能,也避免了很多增删改可能的错误 1.用户收藏视频,收藏课程有必要建立用户 ...

  6. Xshell登录Vagrant方式

    Xshell登录Vagrant方式 我上一篇文章 介绍了vagrant 如何创建虚拟机集群,在上篇文章的基础上,用xshell 登录 虚拟机发现 默认是无法使用账号密码登录root账号,只能使用vag ...

  7. Hearthstone AI

    search keyword `machine learning hearthstone` with google I am a legend: Hacking Hearthstone with ma ...

  8. [Java复习] Spring IoC

    1. Spring bean的生命周期? 1. 对Bean进行实例化(相当于new) 对于BeanFactory 当客户向容器请求一个尚未初始化的bean(或初始化bean需要注入另外一个尚未初始化的 ...

  9. 漫谈Objective-C在语法上的改进

    Objective-C 2.0从2006年正式发布至今已经有10年了.Apple在此期间也不断地为其注入新的语法特性,比如Blocks.NSNumber literal.NSArray literal ...

  10. springboot之activemq安装与实践

    环境:腾讯云centos7 注意:activemq安装插件,可能会报错.本人是主机名的问题,所以修改了主机名. vim /etc/hosts vim /etc/hostname 修改这两个文件,并重启 ...