ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1139. City Blocks

My solution works as follows :
Posted by Mahilewets 13 Jun 2017 21:25
For each x (x=0,1,2,..,n-1) (x is horizontal axis)  find y0=x*tg(a) and y1=(x+1)*tg(a),  where tg(a) is (m-1)/(n-1).  Add to answer floor (y1) - floor(y0) +1. If y1 is a whole number then subtract 1 from answer.