Program | WIRES.PAS, WIRES.C, WIRES.CPP |
A firm, producing chips, NELIT, suffered from lack of profit. So they decided
to cut down producing costs. Their new design would be as simple as possible.
With uninsolated wires they would connect components on the chip and afterwards
they will isolate the wires only on part of segments where two wires have a
common point. Help NELIT designers and write a program which counts pairs of
wires which have at least one common point.
Sample input/output:
3
0 0 1 1
0 1 1 0
2 0 2 1
2
0 0 1 1
2 0 3 1
3
0 0 2 2
0 2 2 0
1 0 1 2
0
Output:
1
0
1