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题解