[백준/C++] 9243 - 파일 완전 삭제

orangesnail·2025년 5월 8일

백준

목록 보기
103/169

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


전체 코드

#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    string b1, b2;
    cin >> b1 >> b2;

    bool success = true;

    for (int i = 0; i < b1.length(); i++) {
        if (n % 2 == 0) {
            if (b1[i] != b2[i]) {
                success = false;
                break;
            }
        }
        else {
            if (b1[i] == b2[i]) {
                success = false;
                break;
            }
        }
    }

    if (success) cout << "Deletion succeeded" << endl;
    else cout << "Deletion failed" << endl;

    return 0;
}
profile
초보입니다. 피드백 환영합니다 😗

0개의 댓글