随笔分类 - 计数
摘要:Recall that the permutation is an array consisting of nn distinct integers from 11 to nn in arbitrary order. For example, [2,3,1,5,4][2,3,1,5,4] is a
阅读全文
摘要:You are given two integers nn and mm. Calculate the number of pairs of arrays (a,b)(a,b) such that: the length of both arrays is equal to mm; each ele
阅读全文
摘要:Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: for the array [0,0,1,0,2][0,0,1,0,2] MEX eq
阅读全文
摘要:You are given string ss of length nn consisting of 0-s and 1-s. You build an infinite string tt as a concatenation of an infinite number of strings ss
阅读全文
摘要:考虑全为0的串数。我们有m个1,相当于有m+1的空隙可以用来放0。那么显然我们把这n-m个0匀着放到这m+1个空隙,可以使得每个0的部分尽可能短,进而使得全为0的子串尽可能少。 所以每个空隙放b=(n-m)/(m+1)。因为不能整除,所有有(n-m) % (m+1)个空隙实际上还要再多一个0。 如果
阅读全文
摘要:VK news recommendation system daily selects interesting publications of one of nn disjoint categories for each user. Each publication belongs to exact
阅读全文
摘要:Your task is to calculate the number of arrays such that: each array contains nn elements; each element is an integer from 11 to mm; for each array, t
阅读全文
摘要:Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce lett
阅读全文

浙公网安备 33010602011771号