
DP_数位dp
文章平均质量分 69
sdau_blue
念念不忘,必有回响。驰而不息,功不唐捐。
展开
-
R - self 同类分布
题目链接:https://cn.vjudge.net/contest/194559#problem/R此题开创了我对数位dp理解的新纪元题目大意:一个最大为18位的整数,判断他是否能够整除自己各个位数的和。分析:这么长的数字只能用状态压缩,但由于是否能够被mod整除,可能每次mod都会变化,就用暴力依次找寻,又因为每个位上的数字最大为9,最多18位,所以9*18便是最大的mod,最后判...原创 2017-11-07 09:25:14 · 336 阅读 · 0 评论 -
F(x)(逆向思维)
F(x)Time Limit: 1000/500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8583 Accepted Submission(s): 3386 Problem DescriptionFor a decimal number x with n...原创 2018-08-24 20:59:41 · 847 阅读 · 0 评论 -
Balanced Number
Balanced NumberTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 7816 Accepted Submission(s): 3722 Problem DescriptionA balanced numbe...原创 2018-08-24 19:19:02 · 148 阅读 · 0 评论 -
1026: [SCOI2009]windy数
1026: [SCOI2009]windy数https://www.lydsy.com/JudgeOnline/problem.php?id=1026Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 10270 Solved: 4777[Submit][Status][Discuss]Description windy定义了一种w...原创 2018-08-24 16:24:51 · 116 阅读 · 0 评论 -
chiaki sequence reloaded(规律+数位dp)
链接:https://www.nowcoder.com/acm/contest/142/C来源:牛客网 题目描述Chiaki is interested in an infinite sequence a1, a2, a3, ..., which defined as follows:Chiaki would like to know the sum of the first n t...原创 2018-07-30 21:55:53 · 665 阅读 · 1 评论 -
T - Palindromic Numbers ——回文数
普通的回文数,很有意思:题目链接:https://cn.vjudge.net/contest/194559#status/20164225a/T/0/代码如下:#include#include#include#includeusing namespace std;typedef long long int ll;ll dp[90][90];//第i位,回原创 2017-11-12 12:10:05 · 296 阅读 · 0 评论 -
P - Mirror Number ————镜像回文
这道题。。要哭了学到了很多知识。1.原来longlong的范围好小,只有10的19次方。超过了就不行了2.终于知道了为什么有的人这么无聊,写个dp非要把第三维无关紧要的加上,原来数字太大的时候,这样dp村的数据可以大一点,大多少我就不知道了,这道题很吃亏3.原来一道很简单的题也可以变得这么恶心。longlong不行,就只好char了成功的把错误率提高了一个水平如果数原创 2017-11-12 12:07:32 · 376 阅读 · 0 评论 -
C - Apocalypse Someday
这道题很666,找第n个含有666的数因为没有longlong声明,就一直错。。。。。题目链接:https://cn.vjudge.net/contest/194559#problem/C状态为之前连续的6的个数,如果已经有三个6了,无论加什么数字都是合法状态,否则加一个不为6的数就重置个数为0二分查找#include#include#include原创 2017-11-11 12:54:50 · 336 阅读 · 0 评论 -
Q - count 数字计数
文章来源:http://m.blog.youkuaiyun.com/ArcCCcp/article/details/78202310这道题实在是不知道怎么写感觉无套路可循看了解析后思路逐渐清晰转载 2017-11-09 21:23:31 · 342 阅读 · 0 评论 -
V - How Many Zeroes?
Jimmy writes down the decimal representations of all natural numbers between and including m and n, (m ≤ n). How many zeroes will he write down?InputInput starts with an integer T (≤ 11000), denot原创 2017-11-09 19:21:33 · 260 阅读 · 0 评论 -
U - Investigation
题目链接:https://cn.vjudge.net/contest/194559#problem/UAn integer is divisible by 3 if the sum of its digits is also divisible by 3. For example, 3702 is divisible by 3 and 12 (3+7+0+2) is also divi原创 2017-11-09 19:17:18 · 188 阅读 · 0 评论 -
Y - odd-even number
题目链接:https://cn.vjudge.net/contest/194559#problem/Y大意:连续奇数的个数是偶数;连续偶数的个数是奇数的这种数的个数分析:刚开始想着pre_ou,pre_ji这两种状态,很麻烦。后来旁敲侧击的知道了用一个judge(yes)标志一下是否满足就可以了。中间有的小地方需要注意 这道题需要学习的地方就是状态,然后dfs的时候细心代码如下:原创 2017-11-09 19:12:29 · 258 阅读 · 0 评论 -
找含有49的个数
https://cn.vjudge.net/contest/194559#problem/H此题和62的类似。就是找含有49的个数,但是重点在于要求的数很大,一直没过。#include#include#include#define LL __int64using namespace std;LL dp[60][5];long long dig原创 2017-10-31 21:50:47 · 344 阅读 · 0 评论 -
含有13,且能被13整除的个数
A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 ar...原创 2017-10-30 23:40:58 · 1237 阅读 · 0 评论 -
hdu2089 不要62和4
//hdu2089 不要62//统计区间[a,b]内没有4和62的数字有多少个#include<iostream>#include<string.h>using namespace std;int dp[1000][5];int dig[1000];int dfs(int pos,int pre,int status,bool limit){ if...原创 2017-10-22 22:48:05 · 262 阅读 · 0 评论 -
Educational Codeforces Round 50 (Rated for Div. 2)—A B C D
哈哈哈哈哈,这场比赛好像有点简单。写下题解吧:http://codeforces.com/contest/1036A:就是一个公式#include<bits/stdc++.h>using namespace std;typedef long long LL;int main(){ LL n,k; while(scanf("%lld%lld",&...原创 2018-09-19 16:55:02 · 182 阅读 · 0 评论