Notice
Recent Posts
Recent Comments
Link
Little Jay
[C++] 백준 12813번 - 이진수연산 본문
어렵지는 않지만 채점하는데 시간이 너무 오래 걸렸던 문제
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
char a[100001];
char b[100001];
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> a >> b;
for (int i = 0; i < strlen(a); i++) {
if (a[i] == '1' && b[i] == '1') cout << '1';
else cout << '0';
}
cout << endl;
for (int i = 0; i < strlen(a); i++) {
if (a[i] == '1' || b[i] == '1') cout << '1';
else cout << '0';
}
cout << endl;
for (int i = 0; i < strlen(a); i++) {
if (a[i] != b[i]) cout << '1';
else cout << '0';
}
cout << endl;
for (int i = 0; i < strlen(a); i++) {
if (a[i] == '1') cout << '0';
else cout << '1';
}
cout << endl;
for (int i = 0; i < strlen(a); i++) {
if (b[i] == '1') cout << '0';
else cout << '1';
}
cout << endl;
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 4358번 - 생태학 (0) | 2022.06.02 |
|---|---|
| [C++] 백준 2018번 - 수들의 합 5 (0) | 2022.05.23 |
| [C++] 백준 10282번 - 해킹 (0) | 2022.05.13 |
| [C++] 백준 1753번 - 최단 경로 (0) | 2022.05.13 |
| [C++] 백준 6118번 - 숨바꼭질 (0) | 2022.05.13 |
Comments