[USACO07MAR] Face The Right Way G
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
头牛排成一列。每头牛或者向前或者向后。为了让所有牛都面向前方,农夫每次可以将 头连续的牛转向 ,求最小的操作次数 和相应的最小 。
输入格式
第一行一个正整数 。
下面 行,每行一个字符 F 或 B,表示一头奶牛的初始朝向。(F 为朝前,B 为朝后)
输出格式
请在一行输出两个数字 和 ,用空格分开。
7
B
B
F
B
F
B
B
3 3
提示
样例解释:,, 次操作分别让奶牛 转向。
对于 的数据,。
国庆集训入门组作业——前缀和&差分
- Status
- Done
- Problem
- 18
- Open Since
- 2025-10-3 9:00
- Deadline
- 2025-10-18 23:59
- Extension
- 24 hour(s)