최대 1 분 소요

1. 문제

[Bronze III] No Brainer - 4562

문제 링크

성능 요약

메모리: 30840 KB, 시간: 64 ms

분류

구현(implementation)

문제 설명

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".

출처: 백준, https://https://www.acmicpc.net/

2. 해결방법 시간복잡도

  1. 단순 코딩 O(N)

3. 문제 해결 및 코드


  • 주석을 참고하면서 이해를 돕습니다.

4. 알고리즘 및 해설

  1. N만큼의 반복문을 통해 2값을 받고 만약 x값이 y값보다 크거나 같은 경우 뇌이므로 MMM BRAINS를 출력한다.
    • 이외에는 뇌가 아니므로 NO BRAINS를 출력한다.