#L16755. P16755 Countdown

P16755 Countdown

Problem Description

题目描述

Avery has an array of N positive integers A_1, A_2, ..., A_N.

A contiguous subarray of length m is an m-countdown if its values, in order, are m, m-1, ..., 2, 1. For example, [3, 2, 1] is a 3-countdown.

Given K, count the number of K-countdowns in the array.

输入格式

The first line contains T, the number of test cases. Each test case consists of N and K, followed by a line containing N integers A_i.

输出格式

For each test case, print Case #x: y, where x is its 1-based case number and y is the number of K-countdowns.

样例

样例 1

提示

Limits: 1 <= T <= 100; 2 <= K <= N; 1 <= A_i <= 200000.

In Test Set 1, 2 <= N <= 1000. In Test Set 2, N may be as large as 200000 for at most 10 test cases; all remaining cases have N <= 1000.

3
12 3
1 2 3 7 9 3 2 1 8 3 2 1
4 2
101 100 99 98
9 6
100 7 6 5 4 3 2 1 100
Case #1: 2
Case #2: 0
Case #3: 1