3 1 2 2
1
665496237
2
When $K = 1$, he will get the $1$\-st candy, $2$\-nd candy, or $3$\-rd candy. In any case, his candy will have one color, so the expected value of the number of different colors is $1$.
When $K = 2$, he will get the $1$\-st and $2$\-nd candies, $2$\-nd and $3$\-rd candies, or $1$\-st and $3$\-rd candies.
* If he gets the $1$\-st and $2$\-nd candies, they have two different colors.
* If he gets the $2$\-nd and $3$\-rd candies, they have one color.
* If he gets the $1$\-st and $3$\-rd candies, they have two different colors.
Thus, the expected value of the number of different colors is $\frac{1}{3} \cdot 2 + \frac{1}{3} \cdot 1 + \frac{1}{3} \cdot 2 = \frac{5}{3}$.
Be sure to print it modulo $998244353$ as described in Notes.
When $K = 3$, he will always get the $1$\-st, $2$\-nd, and $3$\-rd candies, which have two different colors, so the expected value of the number of different colors is $2$.11 3 1 4 1 5 9 2 6 5 3 5
1 725995895 532396991 768345657 786495555 937744700 574746754 48399732 707846002 907494873 7
{
"problem": {
"name": "Colorful Candies 2",
"description": {
"content": "There are $N$ candies arranged in a row from left to right. Each candy has one of the following $10^9$ colors: Color $1$, Color $2$, $\\ldots$, Color $10^9$. For each $i = 1, 2, \\ldots, N$, the $i$",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 4000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc215_g"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ candies arranged in a row from left to right. \nEach candy has one of the following $10^9$ colors: Color $1$, Color $2$, $\\ldots$, Color $10^9$. \nFor each $i = 1, 2, \\ldots, N$, the $i$...",
"is_translate": false,
"language": "English"
}
]
}