코딩로그
[백준/BOJ/C++] 4562번 No Brainer 본문
[문제]
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".
[Source Code]
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int number;
cin >> number;
int *arr = new int[number];
for(int i = 0; i < number; i++){
int first, second;
cin >> first >> second;
if(first < second)
arr[i] = 0;
else
arr[i] = 1;
}
for(int i = 0; i < number; i++){
if(arr[i] == 0)
cout << "NO BRAINS";
else
cout << "MMM BRAINS";
cout << "\n";
}
}
[결과 화면]
'YJ > C++' 카테고리의 다른 글
[백준/BOJ/C++] 17388번 와글와글 숭고한 (0) | 2021.10.12 |
---|---|
[백준/BOJ/C++] 6749번 Next in line (0) | 2021.10.12 |
[백준/BOJ/C++] 4101번 크냐? (0) | 2021.10.12 |
[백준/BOJ/C++] 2752번 세수정렬 (0) | 2021.10.12 |
[백준/BOJ/C++] 1550번 16진수 (0) | 2021.10.08 |