반응형
https://www.acmicpc.net/problem/24736
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
간단 구현문제였습니다.
📕 풀이방법
📔 입력 및 초기화
방문 팀, 홈 팀의 총 점수를 출력할 일차원 배열 score, 5개 점수 목록을 저장할 일차원 배열 info를 선언합니다. 이후 각 팀의 정보를 입력해 info에 저장합니다.
📔 풀이과정
조건에 맞게 info값과 점수를 곱한 총합을 score에 저장합니다.
📔 정답출력
각 팀 점수 score[i]를 출력합니다.
📕 Code
#include <bits/stdc++.h>
using namespace std;
int score[2], info[5];
int main(){
for(int k = 0; k < 2; k++){
for(int i = 0; i < 5; i++) cin >> info[i];
score[k] = info[0] * 6 + info[1] * 3 + info[2] * 2 + info[3] + info[4] * 2;
}
for(int i = 0; i < 2; i++) cout << score[i] << ' ';
}
'Algorithm > Implementation' 카테고리의 다른 글
(C++) - 백준(BOJ) 20540 : 연길이의 이상형 (0) | 2022.03.23 |
---|---|
(C++) - 백준(BOJ) 24365 : ПЧЕЛИЧКАТА МАЯ (0) | 2022.03.22 |
(Python) - 백준(BOJ) 4150 : 피보나치 수 (0) | 2022.03.17 |
(Python) - 백준(BOJ) 2729 : 이진수 덧셈 (0) | 2022.03.16 |
(C++) - 백준(BOJ) 2535 : 아시아 정보올림피아드 (0) | 2022.03.14 |