英语翻译是浙大ACM题库的题目 看不懂Crazy SearchTime Limit:5 Seconds Memory Limit:32768 KB Many people like to solve hard puzzles some of which may lead them to madness.One such puzzle could be finding a hidden prime number in a given te
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/24 10:34:21
英语翻译是浙大ACM题库的题目 看不懂Crazy SearchTime Limit:5 Seconds Memory Limit:32768 KB Many people like to solve hard puzzles some of which may lead them to madness.One such puzzle could be finding a hidden prime number in a given te
英语翻译
是浙大ACM题库的题目 看不懂
Crazy Search
Time Limit:5 Seconds Memory Limit:32768 KB
Many people like to solve hard puzzles some of which may lead them to madness.One such puzzle could be finding a hidden prime number in a given text.Such number could be the number of different substrings of a given size that exist in the text.As you soon will discover,you really need the help of a computer and a good algorithm to solve such a puzzle.
Your task is to write a program that given the size,N,of the substring,the number of different characters that may occur in the text,NC,and the text itself,determines the number of different substrings of size N that appear in the text.
As an example,consider N=3,NC=4 and the text "daababac".The different substrings of size 3 that can be found in this text are:"daa","aab","aba","bab","bac".Therefore,the answer should be 5.
Input
The first line of input consists of two numbers,N and NC,separated by exactly one space.This is followed by the text where the search takes place.You may assume that the maximum number of substrings formed by the possible set of characters does not exceed 16 Millions.
Output
The program should output just an integer corresponding to the number of different substrings of size N found in the given text.
This problem contains multiple test cases!
The first line of a multiple input is an integer N,then a blank line followed by N input blocks.Each input block is in the format indicated in the problem description.There is a blank line between input blocks.
The output format consists of N output blocks.There is a blank line between output blocks.
Sample Input
1
3 4
daababac
Sample Output
5
Intervals
Time Limit:10 Seconds Memory Limit:32768 KB
You are given n closed,integer intervals [ai,bi] and n integers c1,...,cn.
Write a program that:
> reads the number of intervals,their endpoints and integers c1,...,cn from the standard input,
> computes the minimal size of a set Z of integers which has at least ci common elements with interval [ai,bi],for each i = 1,2,...,n,
> writes the answer to the standard output.
Input
The first line of the input contains an integer n (1
英语翻译是浙大ACM题库的题目 看不懂Crazy SearchTime Limit:5 Seconds Memory Limit:32768 KB Many people like to solve hard puzzles some of which may lead them to madness.One such puzzle could be finding a hidden prime number in a given te
先帮你翻一个.
Crazy Search
疯狂搜索
Time Limit:5 Seconds Memory Limit:32768 KB
时限:5秒 内存限制:32768KB
Many people like to solve hard puzzles some of which may lead them to madness.One such puzzle could be finding a hidden prime number in a given text.Such number could be the number of different substrings of a given size that exist in the text.As you soon will discover,you really need the help of a computer and a good algorithm to solve such a puzzle.
许多人想解决难题,其中一些可能会让他们疯狂.一个这样的难题就是找到一个隐藏在给定文本中的质数.这个数字可以是一个存在于这个文本中指定长度的不同子串数.你需要计算机和一个好的算法来帮助你解决这样一个难题.
Your task is to write a program that given the size,N,of the substring,the number of different characters that may occur in the text,NC,and the text itself,determines the number of different substrings of size N that appear in the text.
你的任务是写这样一个程序:给定子串大小N,文本中不同字符的数量NC,和文本,来确定出现在文本中大小为N的不同子串数目.
As an example,consider N=3,NC=4 and the text "daababac".The different substrings of size 3 that can be found in this text are:"daa","aab","aba","bab","bac".Therefore,the answer should be 5.
比如:假设N为3,NC为4,文本为"daababac".这里不同子串大小为3,为"daa","aab","aba","bab","bac".因此,答案应该是5.
Input
输入
The first line of input consists of two numbers,N and NC,separated by exactly one space.This is followed by the text where the search takes place.You may assume that the maximum number of substrings formed by the possible set of characters does not exceed 16 Millions.
输入的第一行包括两个数字:N和NC,它们之间用一个空格隔开.接下来是搜索所用文本.你假设字符集合构成的子串数量最大不超过1600万
Output
输出
The program should output just an integer corresponding to the number of different substrings of size N found in the given text.
程序应输出一个整数,它是文本中找到的大小为N的不相同子串的数量
This problem contains multiple test cases!
该问题包含多种测试用例!
The first line of a multiple input is an integer N,then a blank line followed by N input blocks.Each input block is in the format indicated in the problem description.There is a blank line between input blocks.
多行输入的第一行是整数N,然后一个空行,接下来是N个输入段.每个段是以问题描述中的格式表示的.在输入各段之间有一个空行.
The output format consists of N output blocks.There is a blank line between output blocks.
输出格式包含N个输出段.两段之间有一个空行.
Sample Input
范例输入
1
3 4
daababac
Sample Output
范例输出
5
Intervals
间隔
Time Limit:10 Seconds Memory Limit:32768 KB
时限:10秒 内存限制:32769KB
You are given n closed,integer intervals [ai,bi] and n integers c1,...,cn.
给你n个闭区间整数[ai,bi]和n个整数,c1...,cn
Write a program that:
写一个程序
> reads the number of intervals,their endpoints and integers c1,...,cn from the standard input,
读入间隔数量,结束点,从标准输入得到整数c1,...cn
> computes the minimal size of a set Z of integers which has at least ci common elements with interval [ai,bi],for each i = 1,2,...,n,
计算整数集合Z的最小长度,这个集合至少包括ci个公共元素,这些元素都在[ai,bi]区间内,i=1,2,...,n.
> writes the answer to the standard output.
用标准输出写出答案
Input
输入
The first line of the input contains an integer n (1