Logo
(追記) (追記ここまで)

9741번 - Interior Lattice Points 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB63514384.314%

문제

A lattice point is a point whose coordinates on a rectangular coordinate system are integers. An interior lattice point is a lattice point that is inside a given polygon and not on its boundary. For example, the drawing below shows a triangle having six interior lattice points.

Write a program that reads an input containing three pairs of coordinates (xA, yA), (xB, yB), (xC, yC), where each coordinate is an unsigned integer with a value less than or equal to 100. The numbers in the line are separated exactly by one space and are in the order xA yA xB yB xC yC. The coordinates describe three distinct (but possibly collinear) lattice points. If the given coordinates describe a triangle with non-zero area, then the program should display on the screen the number of interior lattice points of the triangle. Otherwise, the program should display on the screen the number zero. (If the three points are collinear, then there are no interior lattice points.)

입력

The input starts with an integer N (0 ≤ N ≤ 255). This is followed by N input cases. Each input case is a list of six unsigned integers with values not exceeding 100. The six integers xA yA xB yB xC yC correspond to the coordinates (xA, yA), (xB, yB), (xC, yC).

출력

For every input case, print the number of interior lattice points in one line.

제한

예제 입력 1

4
0 0 100 0 100 100
0 0 98 100 100 100
0 0 99 100 100 100
0 0 99 99 100 100

예제 출력 1

4851
49
0
0

힌트

출처

ICPC > Regionals > Asia Pacific > Philippines > Philippines Multi-Provincial Programming Contest > Philippines Multi-Provincial Programming Contest 2013 I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /