洛谷 第一次找规律A了一道紫题,写篇博客纪念一下. 这题很明显是数位dp,但是身为蒟蒻我不会呀,于是就像分块打表水过去. 数据范围是\(10^{12}\),我就\(10^6\)一百万一百万的打表. 于是我就发现了一些规律. 先献给大家一个打表程序吧- #include <bits/stdc++.h> using namespace std; int main() { long long l,r,cnt[10]={}; for (long long t=0;t<=999999;++t) {…
BZOJ原题链接 洛谷原题链接 又是套记搜模板的时候.. 对\(0\sim 9\)单独统计. 定义\(f[pos][sum]\),即枚举到第\(pos\)位,前面枚举的所有位上是当前要统计的数的个数之和为\(sum\). #include<cstdio> #include<cstring> using namespace std; typedef long long ll; const int N = 13; ll f[N][N]; int a[N], nw; inline ll…
题目描述 FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= N <= 10) in a certain order and then sum adjacent numbers to produce a new list with one fewer number. They repeat this until only a single number is lef…