본문 바로가기
백준 알고리즘 코딩

[C언어] 백준 4562번 No Brainer

by 1005_ 2025. 3. 24.

[ 문제 ]

Zombies love to eat brains. Yum.

[ 입력 ]

The first line contains a single integer n indicating the number of data sets.

The following n lines each represent a data set. Each data set will be formatted according to the following description:

A single data set consists of a line "X Y", where X is the number of brains the zombie eats and Y is the number of brains the zombie requires to stay alive.

[ 출력 ]

For each data set, there will be exactly one line of output. This line will be "MMM BRAINS" if the number of brains the zombie eats is greater than or equal to the number of brains the zombie requires to stay alive. Otherwise, the line will be "NO BRAINS".

[ 작성한 코드 ]

#include <stdio.h>

int main()
{
    int n,x,y,i;

    scanf("%d",&n);

    for(i = 0; i < n; i++)
    {
        scanf("%d %d",&x,&y);
        if(x<y)
        {
            printf("NO BRAINS\n");
        }
        else if(x>=y)
        {
            printf("MMM BRAINS\n");
        }
    }
}

 

단순한 입력값 비교 문제라 어려움 없이 풀이를 할 수 있었다.

 

알고리즘 분류

  • 구현