아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Hills

시간 제한2초메모리 제한512 MB

요약
일반 위치 조건을 만족하는 N개의 선분이 이루는 삼각형 영역 중 다른 선분에 잘리지 않은 것의 개수를 센다.
난이도

보통10점 중 7점

유형
기하, 그래프, 시뮬레이션, 구현
정답자
아직 제출이 없습니다

문제

Little Billy likes drawing with chalks of all colors. As a child of his age, all he can do is to draw straight lines. Today he has been told that hills are of the shape of triangles, and he brought out a lot of his works and tried to identify as many hills as he could. Being one of his best friends, you gladly joined his effort. However after working for a while you are desperate to find the huge number of sketches he has produced. You suggested this alternative plan — to code up a program for him.

Figure 1: The Figure Only Containing One Hill

Keep in mind that in Billy’s pictures all the lines are connected, no line will have an end point right on another line, and there is no single point where more than two lines intersect. We would only count the hills that are not cut by other lines.

입력

The first line of the input is a single integer T which is the number of test cases. T test cases follow, each preceded by a single blank line.

Each test case starts with an integer N (1 < N ≤ 500), which is the number of lines on the picture. The next N lines contain a line segment’s two end points. The coordinates are all integers (−10, 000 < x, y < 10, 000).

출력

For each case, print the number of hills on a single line.

예제1

  1. 예제 1

    입력
    3
    
    3
    -1 0 3 0
    0 -1 0 3
    -1 3 3 -1
    
    4
    -3 0 3 6
    3 0 -3 6
    5 3 0 9
    1 0 1 9
    
    6
    -30 -20 30 -20
    -20 -30 -20 30
    -30 20 30 20
    20 -30 20 30
    -30 -10 10 30
    -11 11 -9 9
    
    예상 출력
    1
    2
    0