|
페이 : 3만
내일 오후 6시 이전까지 해주셔야합니다.
가장많이 나온 문자열을 찾아주는 프로그램입니다.
해쉬함수를 이용해서 패스워드를 서치하는 프로그램입니다.
STL과 string 클래스사용 안되고
vector클래스 사용가능합니다.
예를들어
인풋 : 3(사이즈) accacacea
아웃풋 : cac
Length-3 substrings and their frequencies
accacacea acc, cca, cac, aca, cac, ace, cea
acc: 1
cca: 1
cac: 2 <--가장 많이 나온 문자열
aca: 1
ace: 1
cea: 1
Size of all length-15 strings
aaaaaaaaaaaaaaa ~ zzzzzzzzzzzzzzz
0 ~ 26^15–1 (= 1,677,259,342,285,725,925,375)
아래는 원본 문제입니다.
A password with size N can be found by searching the text for the most frequent substring with N characters. After finding the password, the password can be used to decode the message.
Your mission has been simplified as you are only requested to write a program that, given the size of the password and the encoded message, determines the password following the strategy given above.
Input consists of two lines with the size of the password, 0 < N <= 15, followed by the text representing the encoded message whose size is less than or equal to 5,000,000. To simplify things, the input text only includes lower-case alphabet letters.
Ricardo Lopes, CPUP'2003 Round 1
University of Porto local Contest
테스트 case 첨부하여 올립니다
하실분 연락부탁드립니다.
010 2570 1795
|