[C++][백준 4999] 아!

PublicMinsu·2025년 9월 20일

문제

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

접근 방법

aah의 길이는 문자열의 길이라는 점을 활용하면 됩니다.

코드

#include <iostream>
using namespace std;

string strs[2];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    for (string &str : strs)
    {
        cin >> str;
    }

    cout << (strs[0].length() >= strs[1].length() ? "go" : "no");
    return 0;
}

풀이

문자열의 길이를 비교하면 됩니다.
재환이가 낼 수 있는 'aaah'의 길이가 의사가 듣기를 원하는 'aah'의 길이보다 크거나 같으면 go를 작다면 no를 출력하면 됩니다.

profile
연락 : publicminsu@naver.com

0개의 댓글