Sharing Bread
시간 제한2초메모리 제한1024 MB
M명의 사람이 오른쪽으로 탐색해 빵을 하나씩 가져갈 수 있도록 하는 시작 토스터 수열의 개수를 998244353으로 나눈 나머지로 구한다.
문제
There are toasters, numbered from to , from left to right. Initially, each toaster has a single piece of bread in it. There are people, numbered from to , who are one by one looking for bread among the toasters, starting from person , person , and so on.
Person starts looking from toaster () and keeps going right until they found a toaster with a piece of bread in it. In other words, person is looking for the smallest such that and toaster contains bread. If such a toaster exists, then person will take the bread from that toaster and leave; the toaster becomes empty afterward. If such a toaster does not exist, then person will leave empty-handed.
A starting sequence is fair if person starts looking from toaster ai and does not leave empty-handed, for all . Out of all possible starting sequences, determine how many of them are fair modulo .
입력
Input consists of two integers () in a single line representing the number of toasters and the number of people, respectively.
출력
Output an integer in a single line representing the number of fair starting sequence modulo .