XDOJ-1113-Too Light(dp)
来源:互联网 发布:电子设计软件有哪些 编辑:程序博客网 时间:2024/04/29 07:53
题目链接:XDOJ-1113-Too Light
设
状态转移方程为
初始化
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e5+7;char s[maxn];int a[maxn];int dp[maxn][57];int main(){ int k,n; a[0]=0; while(~scanf("%s %d",s+1,&k)) { n=strlen(s+1); for(int i=1;i<=n;i++) a[i]=s[i]-'0'; memset(dp,0,sizeof(dp)); ll ans=0; for(int i=1;i<=n;i++) { for(int j=0;j<k;j++) dp[i][(j*10+a[i])%k]+=dp[i-1][j]; ++dp[i][a[i]%k]; ans+=dp[i][0]; } printf("%lld\n",ans); } return 0;}
0 0
- XDOJ-1113-Too Light(dp)
- XDOJ-1028-数字工程(dp)
- Killer's sentence too light!
- Light oj 1025 (区间dp)
- Light oj 1068 - Investigation(数位dp)
- light Oj 1013 - Love Calculator (dp)
- light oj 1017 - Brush (III) (dp)
- light oj 1031(区间dp入门)
- light oj 1031(区间dp+博弈)
- 【light-oj】-1047 - Neighbor House(dp)
- light oj 1422(区间dp 水题)
- XDU-1112 Too Stupid(DP)
- XDU-1107 Too Simple (DP)
- hdu 4276 The Ghost Blows Light(树型DP)
- hdu 4276 The Ghost Blows Light(树型DP)
- light oj 1422 - Halloween Costumes (区间dp)
- HDU - 4276 The Ghost Blows Light(spfa + 树上dp)
- 【HDU】The Ghost Blows Light(树状DP)
- 通过反射获取系统中所有继承了某接口的类
- 重新打包apk问题:jarsigner: 无法打开 jar 文件:
- 集合框架
- 欢迎使用CSDN-markdown编辑器
- js实现单个div闪烁
- XDOJ-1113-Too Light(dp)
- 一文读懂CNN
- 内联函数
- 将二叉树拆成链表
- 安装Sublime Text 3插件的方法
- C# study1
- 读书笔记——面向对象的六大原则
- 初识常量和变量
- POJ3013