본문 바로가기

Algorithm/Implementation

(C++) - 백준(BOJ) 16727번 : ICPC

반응형

https://www.acmicpc.net/problem/16727

 

16727번: ICPC

The first line of the input contains two space-separated integers p1 and s1, where p1 and s1 are the number of goals scored by Persepolis and Esteghlal, respectively, in the first match in which Persepolis is the home team. The second line contains two spa

www.acmicpc.net

단순 구현 문제였습니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;
int main() {
    int a[4];
    for (int i = 0; i < 4; i++)
        cin >> a[i];
    if (a[0+ a[3> a[1+ a[2]) cout << "Persepolis\n";
    else if (a[0+ a[3< a[1+ a[2])cout << "Esteghlal\n";
    else //각자 팀의 최종 점수가 같다면
    {
        //각자 팀의 away점수가 같다면
        if(a[1== a[3])
            cout << "Penalty\n";
        else
        {
            if(a[1]<a[3])
                cout << "Persepolis\n";
            else
                cout << "Esteghlal\n";
        }
    }
}