RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00483

Mate

Unrated 레이팅 미적용
난이도
2s
시간 제한
128MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

2 \(s / 128\) \(MB / 100\) points

Little Mate got an array of lowercase letters from the English alphabet as a present from his

parents. In order to have at least some use of such a clever present, he decided to use it for

finding rhymes when writing his next song.

To find a specific rhyme, Mate wants to select a word of length \(D\) that ends with an array of

characters \(XY\) , i.e. where the next to last letter is \(X\) , and the last \(Y\) . Mate’s process of

selecting a word is by first crossing out some letters in a given sequence, and then merging

the letters he didn’t cross out into a single word. He wants to know in how many different

ways he can cross out the letters so that he meets the given conditions.

The selection of two words is considered distinct if the sets of positions of the cross\(ed-ou\)t

letters are different.

제약

In test cases worth 40% of total points, it will hold | \(S\) | ≤ 50.
In test cases worth an additional 40% of total points, it will hold | \(S\) | ≤ 200.

2 \(s / 128\) \(MB / 100\) points

입력 형식

The first line of input contains an array of lowercase letters of the English alphabet \(S\) (2 ≤| \(S\) |

≤ 2000).
The second line of input contains the integer \(Q\) (1 ≤ \(Q \le 500\,000\)), the number of different

rhymes for which Mate needs to select words.
Each of the following \(Q\) lines contains the integer \(D\) (2 ≤ \(D\) ≤| \(S\) |) and an array of lowercase

letters of the English alphabet \(XY\) from the task.

출력 형식

The \(i\) ^{th} out of \(Q\) lines must contain the required number of ways for the \(i\) ^{th} rhyme. Since that

number can be quite large, output only the value modulo 1 000 000 007 .

예제 1
입력
banana
3
2 na
3 ba
4 nn

malimateodmameitate
3
10 ot
7 aa
3 me
출력
output
3
0
1

2
464
56
설명

Clarification of the first test case:
Word of length 2 that ends with “na” can be obtained in the following ways:
b a n a n a , b a n a n a , b a n a n a .

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2017/2018 Contest 6

평가 및 의견

Mate

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Mate

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8