MicrosoftOA #28
Get Minimum Time
估计困难可在线判题
The time spent at school on a day is the difference in hours between the latest and earliest classes attended that day, plus 1; it is 0 if no class is attended. You may skip at most K classes in total. Find the minimum total time at school over all days.
输入格式
The first line contains N M K (each 1..200), followed by N lines, each a 01 string of length M.
输出格式
Output a single integer, the answer.
样例 1
输入:
1 5 1
10001
输出:
1
样例 2
输入:
2 2 1
11
01
输出:
2
样例 3
输入:
1 3 1
000
输出:
0
样例说明
Example 1: skip either class and attend only the other, spending 1 hour at school.
Example 2: skip the only class on the second day; the first day takes 2 hours, for a total of 2.
Example 3: there are no classes, so there is no need to go to school; the answer is 0.