본문 바로가기
Study (etc)/Problem Solving

[BOJ / C++] 24736번 : Football Scoring

by Haren 2023. 1. 3.

문제

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.

Solved.ac 레벨

브론즈 V

번역

 

글 읽기 - (번역) 24736 - 미식축구

댓글을 작성하려면 로그인해야 합니다.

www.acmicpc.net

풀이

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int t, f, s, p, c;
    int sumA = 0;
    int sumB = 0;

    cin >> t >> f >> s >> p >> c;
    sumA += (t * 6) + (f * 3) + (s * 2) + p + (2 * c);
    
    t = 0; f = 0; s = 0; p = 0; c = 0;

    cin >> t >> f >> s >> p >> c;
    sumB += (t * 6) + (f * 3) + (s * 2) + p + (2 * c);

    cout << sumA << " " << sumB << "\n";


    return 0;
}

 

 

24736번: Football Scoring

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

www.acmicpc.net