아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Hash

시간 제한2초메모리 제한256 MB

요약
해시 매개변수 a와 b가 주어질 때, 길이 50 이하의 서로 다른 소문자 문자열 100개를 만들어 모두 같은 해시 값을 갖도록 한다.
난이도

보통10점 중 7점

유형
해시맵, 수학, 정수론, 구현
정답자
아직 제출이 없습니다

문제

A HAIKU is a string that consists of at most 50 lowercase English letters. For a HAIKU ss, you can compute the hash hh as follows:

h = 0
for i=0,...|s|-1
    h = (h * a + (s[i] - 'a' + 1)) % b

You are given two integers aa and bb. Construct 100 distinct HAIKUs that have the same hash.

입력

You are given two space-separated integers aa and bb (b≤109b \le 10^9, 26≤a<b26 \le a < b).

출력

Print 100 HAIKUs with the same hash, one per line.

힌트

Several HAIKUs are omitted in the printed version of statements; the full version is published in the contest system.

예제1

  1. 예제 1

    입력
    26 52
    
    예상 출력
    aaz
    baz
    caz
    daz
    ...
    zaz
    aaaz
    abaz
    ...
    cuaz
    cvaz