来自《挑战程序设计竞赛》
1.题目原文
Problem
A local high school is going to hold a final exam in a big classroom. However, some students in this school are always trying to see each other's answer sheet during exams!
The classroom can be regarded as a rectangle of M rows by N columns of unit squares, where each unit square represents a seat.
The school principal decided to set the following rule to prevent cheating:
Assume a student is able to see his left, right, upper-left, and upper-right neighbors' answer sheets. The assignment of seats must guarantee that nobody's answer sheet can be seen by any other student.
As in this picture, it will not be a good idea to seat anyone in A, C, D, or E because the boy in the back row would be able to see their answer sheets. However, if there is a girl sitting in B, he will not be able to see her answer sheet.
Some seats in the classro

本地一所高中的期末考试将在一个大教室中举行,但有些学生总是试图在考试中偷看别人的答案!教室被视为一个M行N列的矩形网格,每个单元格代表一个座位。为了防止作弊,必须确保每个人不能看到其他人的答案。题目要求确定最多可以安排多少名学生坐下,使得没有人能看到其他人的答案。输入包含教室的尺寸和座位状态,输出能容纳的最大学生数。案例限制和数据规模也给出。
最低0.47元/天 解锁文章
199

被折叠的 条评论
为什么被折叠?



