HBC201087City题解

一天到晚红烧的鱼 算法基础篇 36 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Hi ICPCer, welcome to Xi'an. Being a beautiful ancient city, Xi'an is the capital city of Zhou, Qin, Han, and Tang Dynasties. With a long history, the streets in Xi'an have a grid pattern. Attracted by the streets' structure, Coach Pangtextit{Pang}Pang would like to conduct his research on them. He draws an n×mntimes mn×m grid on the board. The grid consists n+1{n+1}n+1 vertical line segments and m+1{m+1}m+1 horizontal line segments. The vertical and horizontal line segments intersect at exactly (n+1)×(m+1)(n+1)times(m+1)(n+1)×(m+1) points, forming n×mntimes mn×m unit squares. We call the (n+1)×(m+1)(n+1)times (m+1)(n+1)×(m+1) intersections gridpointtextit{grid point}gridpoints. Output the number of line segments l{l}l satisfying the following three conditions: 1.The length is not zero. 2.Both endpoints of l{l}l are grid points. 3.The midpoint of l{l}l is a grid point.

Hi ICPCer, welcome to Xi'an. Being a beautiful ancient city, Xi'an is the capital city of Zhou, Qin, Han, and Tang Dynasties. With a long history, the streets in Xi'an have a grid pattern. Attracted by the streets' structure, Coach Pangtextit{Pang}Pang would like to conduct his research on them. He draws an n×mntimes mn×m grid on the board. The grid consists n+1{n+1}n+1 vertical line segments and m+1{m+1}m+1 horizontal line segments. The vertical and horizontal line segments intersect at exactly (n+1)×(m+1)(n+1)times(m+1)(n+1)×(m+1) points, forming n×mntimes mn×m unit squares. We call the (n+1)×(m+1)(n+1)times (m+1)(n+1)×(m+1) intersections grid pointtextit{grid point}grid points. Output the number of line segments(not only vertical or horizontal) l{l}l satisfying the following three conditions: 1.The length is not zero. 2.Both endpoints of l{l}l are grid points. 3.The midpoint of l{l}l is a grid point.

HBC201087City题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC201087City题解