HBC245376EnigmaticPartition01string题解

庄子墨 算法基础篇 46 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
A string s0 is given, only consisting of 0 and 1. The j-th character of the string si is si,j , when the index starts from 0. We defifine si as follows: The length of si is less than the length of si1 by 1. And for each letter si,j in the string si , si,j = max. For example, if s0 = 1010, then s1 = 111, s2 = 11, etc. f represents the number of 1 in the string s. Please print the result ofΣi=0kfSigma_{i=0}^{k}fΣi=0kf.

A string s0 is given, only consisting of 0 and 1. The j-th character of the string si is si,j , when the index starts from 0. We defifine si (i ≥ 1) as follows: The length of si is less than the length of si−1 by 1. And for each letter si,j in the string si , si,j = max(si−1,j , si−1,j+1). For example, if s0 = 1010, then s1 = 111, s2 = 11, etc. f(s) represents the number of 1 in the string s. Please print the result of Σi=0kf(si)Sigma_{i=0}^{k}f(s_{i})Σi=0k​f(si​).

HBC245376EnigmaticPartition01string题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC245376EnigmaticPartition01string题解