This is comment for paste
Логические операции «и», «или», «не»
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- // Считайте информацию о трёх домах, которые видит перед собой Марта,
- // а также показания очевидца.
- // Выведите номера тех домов (1, 2, 3) которые нужно посетить,
- // по одному номеру в каждой строке
- string c1, c2, c3, seen;
- int h1, h2, h3, seen_cat;
- cin >> c1 >> h1 >> c2 >> h2 >> c3 >> h3 >> seen >> seen_cat;
- if ((c1 == seen && h1 == seen_cat) || (seen == "?"s && seen_cat == h1) || (seen == c1 && seen_cat == -1)) {
- cout << 1 << endl;
- }
- if ((c2 == seen && h2 == seen_cat) || (seen == "?"s && seen_cat == h2) || (seen == c2 && seen_cat == -1)) {
- cout << 2 << endl;
- }
- if ((c3 == seen && h3 == seen_cat) || (seen == "?"s && seen_cat == h3) || (seen == c3 && seen_cat == -1)) {
- cout << 3 << endl;
- }
- else if (seen == "?"s && seen_cat == -1) {
- cout << 1 << endl
- << 2 << endl
- << 3 << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment