Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
数组求和问题
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 102, Accepted users: 91
Problem 11461 : No special judgement
Problem description
  给定一个长度为n的数组,从这个数组里面随机从前往后取m个数,使得这m个数的和是S,并且这m个数每相邻的两个数的下标相差为p。

Input
  首先是一个整数t,表示有t组数据,每组数据首先是四个整数,n(1<=n<=100000),m(1<=m<=n),S(0<=S<=10^9),
p(1<=p<=100000)意思如题目描述,接下来一行有n个非负数,都小于10^9,表示数组元素的值。


Output
  对于每组数据,首先输出”case #:”,#从一开始,接下来一个数就输出方案总数。输出格式详见样例。

Sample Input
3
10 2 5 2
1 2 1 3 1 3 2 2 3 2
5 2 10 1
5 5 5 5 5
6 3 10 2
4 2 4 4 4 4
Sample Output
case 1:3
case 2:4
case 3:1
Problem Source
  HUNNU Contest 

Submit   Discuss   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:19009 today,16242000 total, since 2010-05-07