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

20705번 - Geometrical Combinatorics 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB36171551.724%

문제

Grace is developing a brand new theory of geometrical combinatorics --- a study about geometrical properties of combinatoric objects.

Consider two triangles on plane --- a Pascal's triangle and an ordinary triangle. Pascal's triangle is drawn with it's root at point (0, 0), and two sides along diagonals of upper-halfplane quarters. Formally, there are 1's written in points $(i, i)$ and $(-i, i),ドル and between them at point $(-i + 2 k, i)$ there is a number equal to the sum of numbers at $(-i + 2k + 1, i - 1)$ and at $(-i + 2k - 1, i - 1)$ for all $k$ from 1ドル$ to $i - 1$. An ordinary triangle is drawn as just a triangle with vertices at $(x_A, y_A),ドル $(x_B, y_B),ドル $(x_C, y_C)$.

Grace defines an intersection value of Pascal's triangle and an ordinary triangle as the sum of values of Pascal's triangle inside or on the border of the ordinary triangle. Can you develop a program that calculates this intersection value?

입력

On the first line there is an integer $t$ (1ドル \le t \le 5$) --- the number of tests to process. Each of the next $t$ lines contains 6 integers $x_A,ドル $y_A,ドル $x_B,ドル $y_B,ドル $x_C,ドル $y_C$ ($-10^6 \le x_A, y_A, x_B, y_B, x_C, y_C \le 10^6$). Three points in each test do not lie on a line.

출력

For each test output an integer --- the intersection value modulo 10ドル^9+7$.

제한

예제 입력 1

2
0 -1 -4 3 4 3
5 4 0 1 3 -2

예제 출력 1

15
2

힌트

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > Northern Eurasia Finals 2020 (Online) G번

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

출처

대학교 대회

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

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