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

18691번 - Pokemon Buddy 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB28381116104139.447%

문제

Pokemon Go just released the Buddy update. It lets you select a Pokemon to appear alongside your trainer’s avatar on your profile screen. As you walk with your buddy, it will find candy that can be used to evolve the Pokemon.

The Buddy system divides the Pokemons into 3 groups. Each group gives one candy upon walking for 1, 3, and 5 kilometers respectively

In this problem you will be given the Pokemon group G, the number of candies C you initially have, and the number of candies E required to evolve the Pokemon. You should calculate the number of Kilometers required to walk in order to evolve the Pokemon.

입력

Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100).

Each test case consists of a line containing three space separated integers:

  • G: The group of the Pokemon (1 ≤ G ≤ 3)
  • C: The initial candies you have (0 ≤ C ≤ 100)
  • E: The candies required to evolve the Pokemon (1 ≤ E ≤ 100)

출력

For each test case, print a single line containing the number of Kilometers of walking required to Evolve the Pokemon.

제한

예제 입력 1

2
1 15 51
1 18 21

예제 출력 1

36
3

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > 2016 Arab Collegiate Programming Contest K번

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

출처

대학교 대회

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

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