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

27032번 - Farmer John's View 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB552100.000%

문제

In order to escape the boring scenery next to his old farm, Farmer John has decided to move away from the Wisconsin plains to a new location near the mountains. From this new location, if he looks around at the view in all 360 degrees around him, he sees mountains in some directions and no mountains in other directions. He wants to know what fraction of his view is made up of mountains.

A total of N (1 ≤ N ≤ 1000) mountain ranges surround FJ's new location. When he looks at any one of them, it appears as a contiguous range. Think of the view as a circle divided up into 360 little arcs, each of them corresponding to 1 degree. Each of these little arcs is subdivided into 60 arc-minutes and each of these is further divided into 60 arc-seconds. In order to precisely record the range of his view occupied by each mountain range, FJ writes down the starting and ending angle of each range. For example:

Range #34 starts at 45 degrees, 2 minutes, 59 seconds, and ends at 120 degrees, 10 minutes, and 0 seconds.

Of course, this description is somewhat ambiguous since it does not specify whether the range curves clockwise or counterclockwise around his field of view. However, FJ notices that no mountain range occupies 180 degrees or more of his field of view, thereby removing any ambiguity. The sample range above therefore occupies a total of 270,421 arc seconds. The angles occupied by different mountain ranges may overlap, and FJ wishes to compute the total number of arc seconds in his field of view that are occupied by mountains.

입력

  • Line 1: A single integer, N
  • Lines 2..N+1: Each line describes a mountain range's arc and contains 6 space-separated integers. The first three integers correspond to the (degree, minute, second) of the starting angle of the range and the last three correspond to the (degree, minute, second) of the ending angle of the range.

출력

  • Line 1: A single integer giving the total number of arc seconds in FJ's view that are occupied by mountains.

제한

예제 입력 1

3
45 2 59 60 30 30
50 10 2 120 10 0
355 0 0 356 0 0

예제 출력 1

274021

힌트

The first two ranges overlap slightly and cover a combined angle of 270421 arc seconds. The third range covers 3600 arc seconds.

출처

Olympiad > USA Computing Olympiad > 2003-2004 Season > USACO February 2004 Contest > Orange 3번

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

출처

대학교 대회

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

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