HCPC points on this side of a line

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

You are given an integer n and a pair of distinct integer valued (x, y) coordinates on the boundary of the grid. The coordinates are indexed from 1. The points will always be on different sides of the grid and neither of them will be (1,1).

Output the number of integer points in an n by n grid that are on the same side of the line between the two boundary points as the coordinate (1,1). Points that are exactly on the line should be counted as well.

Options

exec is denied

rejudge feature is enabled

now post-mortem time, all source codes will be revealed

Sample input:_

10
1 2
10 7

Sample output:

41

Sample input:_

8
8 3
3 8

Sample output:

49

Sample input:_

8
7 1
8 2

Sample output:

63

Ranking

Python3 _

RankUserSizeTimeDateStatistics
1David Sharick2160.14402024/02/06 08:29:320B / ?B / ?B

gs2 _

RankUserSizeTimeDateStatistics
1whio100.21332024/02/18 01:47:473B / 4B / 3B

Language Ranking_

RankLangUserSizeScore
1gs2whio1010000
2Python3David Sharick216462

return to the top page