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

26336번 - Are We Stopping Again? 다국어

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

문제

Going on a road trip is an adventure for Dr. Orooji and his family. Obviously he has to stop to refuel the car, but he also stops whenever his kids want to eat. Dr. O needs to figure out the number of stops before going on the trip so he is mentally prepared.

Find the total number of stops for Dr. O’s trip, given:

  1. Total miles to be traveled.
  2. How often he stops for gas (in miles).
  3. How often he stops for food (in miles).

Assume that the car’s gas tank is full at the beginning of the trip and the kids are full as well. If the destination happens to be the time to refuel (or eat), do not count it as a stop. Also, if a particular mileage happens to be both refueling time and eating time, count it as one stop and not two stops.

Note that if a particular mileage happens to be refueling time only, kids won’t eat at that stop. Similarly, if a particular mileage happens to be eating time only, the car is not refueled at that stop.

입력

The first input line contains a positive integer, t, indicating the number of trips to check. The trips are on the following t input lines, one trip per line. Each trip provides three integers (each between 1 and 1000, inclusive); these are the three values specified in order above.

출력

For each trip, output the three input values. Then, on the next output line, print the number of stops for the trip.

제한

예제 입력 1

3
100 30 40
10 5 1
20 3 4

예제 출력 1

100 30 40
5
10 5 1
9
20 3 4
9

힌트

출처

University > University of Central Florida > 2013 Local Programming Contest 11번

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

출처

대학교 대회

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

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