1 분 소요

1. 문제

[Bronze V] Football Scoring - 24736

문제 링크

성능 요약

메모리: 30860 KB, 시간: 72 ms

분류

사칙연산(arithmetic), 수학(math)

문제 설명

There are five ways to score points in american professional football:

  1. Touchdown - 6 points
  2. Field Goal - 3 points
  3. Safety - 2 points
  4. After touchdown
    1. 1 point (Field Goal or Safety) - Typically called the “Point after”
    2. 2 points (touchdown) - Typically called the “Two-point conversion”

(https://operations.nfl.com/the-rules/nfl-video-rulebook/scoring-plays/)

Given the box score values for two competing teams, calculate the point total for each team.

입력

There are two lines of input each containing five space-separated non-negative integers, T, F, S, P and C representing the number of Touchdowns, Field goals, Safeties, Points-after-touchdown and two-point Conversions after touchdown respectively. (0 ≤ T ≤ 10), (0 ≤ F ≤ 10), (0 ≤ S ≤ 10), (0 ≤ (P+C) ≤ T). The first line represents the box score for the visiting team, and the second line represents the box score for the home team.

출력

The single output line consists of two space-separated integers showing the visiting score and the home score respectively.

출처: 백준, https://https://www.acmicpc.net/

2. 해결방법 시간복잡도

  1. 단순 코딩 O(N)

3. 문제 해결 및 코드


  • 주석을 참고하면서 이해를 돕습니다.

4. 알고리즘 및 해설

  1. 문제에서 제시한 득점 방법을 바탕으로 해당 문제를 해결한다.
    • 반복문이 2포인트 전환점을 기준으로 각각 조건에 맞게 곱한 뒤 출력해준다.