Codeforces 1327 E. Count The Blocks(递推找规律)
题意:
给出一个 n n n,求 1 0 n 10^n 10n 内长度为 1 1 1到 n n n的块分别有多少个。块的含义是连续相同数字的长度。
第一眼以为数位 d p dp dp 暴力打表出前几项很容易就会发现规律
F i − 1 = 10 ∗ F i + 81 ∗ 1 0 n − i − 1 , i < n − 1 F_{i-1}=10∗F_i+81∗10^{n−i−1},i<n−1 Fi−1=10∗Fi+81∗10n−i−1,i<n−1
AC代码:
const int N = 2e5 + 10;
const int mod = 998244353;
int n, m;
ll ans[N];
int main()
{ll x = 810;ans[1] = 10;ans[2] = 180;rep(i, 3, N){ans[i] = ans[i - 1] * 10 + x;x *= 10;ans[i] %= mod;x %= mod;}sd(n);per(i, n, 1)printf("%lld%c", ans[i], i == 1 ? '\n' : ' ');return 0;
}
Codeforces 1327 E. Count The Blocks(递推找规律)相关推荐
- [codeforces 1327E] Count The Blocks 打表找规律+根据规律找公式+优化公式
Educational Codeforces Round 84 (Rated for Div. 2) 比赛人数13522 [codeforces 1327E] Count The Blocks ...
- MT【103】二阶递推找规律
评:如果直接找$a_n$的二阶递推式:$a_{n+2}-2\sqrt{2}a_{n+1}-a_n=0$有根号,不利于估计尾数. 转载于:https://www.cnblogs.com/mathstud ...
- *【HDU - 1517】【POJ - 2505】A Multiplication Game(博弈,递推找规律或SG函数)
题干: Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers ...
- 牛客网 水题 递推找规律
链接: https://www.nowcoder.com/acm/contest/91/E 来源:牛客网 小Y买了很多苹果,但他很贪吃,过了几天一下就吃剩一只了.每一天小Y会数出自己的苹果个数X,如果 ...
- Codeforces Round #715 (Div. 1) B. Almost Sorted 找规律
传送门 文章目录 题意: 思路: 题意: 思路: 找规律yydsyydsyyds. 一看没什么想法,所以打了个表,好家伙,不打不知道,一打不得了,下面是n=6n=6n=6的符合要求的情况: 不难发现, ...
- *【CodeForces - 202C 】Clear Symmetry (思维,找规律,特判)
题干: Consider some square matrix A with side n consisting of zeros and ones. There are nrows numbered ...
- 【CodeForces - 764D】Timofey and rectangles (四色定理 + 找规律 + 构造)
题干: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane ...
- 【CodeForces - 764A】Taymyr is calling you (找规律,水题)
题干: Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taym ...
- Codeforces 1253/C. Sweets Eating(前缀和+找规律)
传送门 题意:给定一个长度为n的序列,代表每个糖果的糖度,每颗糖果经过d天后糖度将变为 d*ai ;xx每天最多可以吃k课糖果,问怎么选择糖果,使得吃掉 g 颗糖果xx获得的最少糖度:例如:n=9,k ...
最新文章
- 黑马程序员---基础加强-----------------第二天(新特性:注解、泛型)
- 设计模式之简单工厂模式学习笔记
- CSS设计指南(读书笔记 - 选择器)
- 岗位推荐 | 微软AI Research Group招聘自然语言处理AI算法研究实习生
- python网络编程能做什么_python网络编程——什么是socket?
- 逻辑电平0和1的世界
- 云中漫步 - 3:2013-4-27 微软云体验营北京站
- 写给90后快30岁的我们
- java开发安装程序_创建java开发环境安装包
- [Jetty]基于Java Servlet的支持WebSocket的服务器
- 【clion】实现类似自定义代码自动补全的功能(懒人利器)
- html 超链接 中文转码,html和Url转码与解码
- 历史课-以追剧的方式了解历史
- Java中的IO整理
- MATLAB——KNN分类器实例
- 计算年龄:sql计算
- Axure8元件库.rplib(Iaxure)
- cadence Virtuoso ADE原理图库中的VCVS(压控电压源)使用
- sap 中怎样把非限制库存转为销售订单库存?
- 华为鸿蒙,告别 PPT,代码全部开源!