알고리즘

[알고리즘] 백준 4435 - 중간계 전쟁 (C++)

blueberrysoda 2025. 3. 12. 22:36

[문제 링크] : https://www.acmicpc.net/problem/4435

#include <iostream> 
using namespace std;
 
int main(){
    int T;
    cin >> T;

    for(int i=1; i<=T; i++){
        int T1 = 0, T2 = 0, tmp;

        for(int j=0; j<6; j++){
            cin >> tmp;

            if(j == 0){
                T1 += 1 * tmp;
            }
            else if(j == 1){
                T1 += 2 * tmp;
            }
            else if(j == 2){
                T1 += 3 * tmp;
            }
            else if(j == 3){
                T1 += 3 * tmp;
            }
            else if(j == 4){
                T1 += 4 * tmp;
            }
            else if(j == 5){
                T1 += 10 * tmp;
            }
        }

        for(int j=0; j<7; j++){
            cin >> tmp;
            
            if(j == 0){
                T2 += 1 * tmp;
            }
            else if(j == 1){
                T2 += 2 * tmp;
            }
            else if(j == 2){
                T2 += 2 * tmp;
            }
            else if(j == 3){
                T2 += 2 * tmp;
            }
            else if(j == 4){
                T2 += 3 * tmp;
            }
            else if(j == 5){
                T2 += 5 * tmp;
            }
            else if(j == 6){
                T2 += 10 * tmp;
            }
        }
 
        cout << "Battle " << i << ": ";
 
        if(T1 > T2){
            cout << "Good triumphs over Evil\n";
        }
        else if(T1 < T2){
            cout << "Evil eradicates all trace of Good\n";
        }
        else{
            cout << "No victor on this battle field\n";
        }
    }
 
    return 0;
}