웅재의 코딩세상

[프로그래머스] 조건 문자열 본문

코딩테스트/프로그래머스 - LV 0

[프로그래머스] 조건 문자열

웅드 2024. 1. 25. 14:39

 

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

int solution(string ineq, string eq, int n, int m) {
    int answer = 0;
    if((ineq == "<" && eq == "=" && n <= m) || (ineq == ">" && eq == "=" && n >= m) ||
      (ineq == "<" && eq == "!" && n < m) || (ineq == ">" && eq == "!" && n > m)) return 1;
    return 0;
}
반응형