bzoj2023/1630
来源:互联网 发布:淘宝全球购怎么干 编辑:程序博客网 时间:2024/04/29 22:07
沉迷文化无法自拔(划掉)
分析:dp加上前缀和乱搞。
搞了个月榜rank2 ,不知道rank1怎么刷的,是不是停课了。。
#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#define ll long long #define mo 1000000#define fo(i,a,b) for(int i=a;i<=b;i++)#define fd(i,a,b) for(int i=a;i>=b;i--)using namespace std;int n,m,l,r,t,ans;const int N=1e5+5;int f[2][N],g[2][N],a[N];int main(){ scanf("%d%d%d%d",&n,&m,&l,&r); fo(i,1,m) { int x; scanf("%d",&x); a[x]++; } f[0][0]=f[1][0]=g[0][0]=g[1][0]=1; fo(i,1,r) g[0][i]=1; t=0; fo(i,1,n) { t^=1; fo(j,1,r) { if (j>a[i]) f[t][j]=(g[t^1][j]-g[t^1][j-a[i]-1]+mo)%mo; else f[t][j]=g[t^1][j]%mo; g[t][j]=(g[t][j-1]+f[t][j])%mo; } } ans=0; fo(i,l,r) ans=(ans+f[t][i])%mo; printf("%d\n",ans); return 0;}
0 0
- bzoj2023/1630
- bzoj2023
- BZOJ2023/1630: [Usaco2005 Nov]Ant Counting 数蚂蚁
- [BZOJ1630]=[BZOJ2023][Usaco2007 Demo]Ant Counting
- bzoj2023【Usaco2005 Nov】Ant Counting 数蚂蚁
- 1630
- UVa 1630
- UVA 1630 folding
- UVA 1630 Folding
- uva 1630 Folding
- ZCMU-1630-半毛钱关系
- 奶瓶战斗机:大明1630
- 习题9-4 uva 1630
- uva 1630——Folding
- Hust oj 1630 网线(MST)
- UVA 1630 记忆化搜索
- ccsu 1630卧底 并查集
- HUST 1630 largest rectangle(思维题)
- 使用JS模拟Map容器
- 带你揭开synchronized同步机制的神秘面纱
- 课前检测 2017 3 23
- redis客户端 (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to per
- CSS网页布局常见问题小结
- bzoj2023/1630
- 微服务架构下,打造别具一格的服务治理体验(下)
- 使用FastJSON,将对象或数组和JSON串互转
- bzoj 4527
- ${param}页面间传值
- 【程序15】成绩>=90分用A表示,60-89分用B表示, 60分以下用C表示。
- uboot 分析之旅
- POJ 1753
- 如何实现文件下载的次数统计?