编程介的小学生 2019-06-28 17:02 采纳率: 20.5%
浏览 106

选士兵所有被选中的士兵的平均分数必须大于a问题,怎么采用 C语言的编程语言的程序设计实现

Problem Description
Anti-terrorism is becoming more and more serious nowadays. The country now has n soldiers,and every solider has a score.

We want to choose some soldiers to fulfill an urgent task. The soldiers chosen must be adjacent to each other in order to make sure that they can cooperate well. And all the soldiers chosen must have an average score greater than a.

Now, please calculate how many ways can the chief of staff choose the soldiers.

Input
The first line consists of a single integer t, indicating number of test cases.

For each test case, the first line gives n, the number of soldiers, and a, the minimum possible average score(n<=100000,a<=10000). The second line gives n integers, corresponding to the soldiers' scores in order. All the scores are no greater than 10000.

Output
An integer n, number of ways to choose the soldiers.

Sample Input
2
5 3
1 3 7 2 4
1 1000
9999

Sample Output
10
1

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题