|
||||||||||
Girls Love 233Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 970 Accepted Submission(s): 332 Problem Description Besides skipping class, it is also important to meet other girls for luras in the new term. As you see, luras sneaked into another girl's QQgroup to meet her indescribable aim. However, luras can only speak like a cat. To hide her real identity, luras is very careful to each of her words. She knows that many girls love saying "233"£¬however she has already made her own word at first, so she needs to fix it. Her words is a string of length n£¬and each character of the string is either '2' or '3'. Luras has a very limited IQ which is only m. She could swap two adjacent characters in each operation, which makes her losing 2 IQ. Now the question is, how many substring "233"s can she make in the string while her IQ will not be lower than 0 after her operations? for example, there is 1 "233" in "2333", there are 2 "233"s in "2332233", and there is no "233" in "232323". Input The first line is an integer T which indicates the case number. and as for each case, the first line are two integers n and m,which are the length of the string and the IQ of luras correspondingly. the second line is a string which is the words luras wants to say. It is guaranteed that¡ª¡ª 1 <= T <= 1000 for 99% cases, 1 <= n <= 10, 0 <= m <= 20 for 100% cases, 1 <= n <= 100, 0<= m <= 100 Output As for each case, you need to output a single line. there should be one integer in the line which represents the largest possible number of "233" of the string after her swap. Sample Input
Sample Output
Source | ||||||||||
|