B直接模拟就好了吧 C就https://www.luogu.com.cn/problem/P3834稍微改一下就过了