Official
A - Raise Both Hands Editorial by en_translator
For beginners
- If you are new to learning programming and do not know where to start, please try Problem A "Welcome to AtCoder" from practice contest. There you can find a sample code for each language.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
- 「Python入門 AtCoder Programming Guide for beginners (APG4bPython)」 is a Python tutorial for competitive programmers. Again, this is only in Japanese.
Divide into cases based on the values \(L\) and \(R\).
If \(L = 0\) and \(R = 0\), then print Invalid
; if \(L = 0\) and \(R = 1\), print No
; if \(L = 1\) and \(R = 0\), print No
; and if \(L = 1\) and \(R = 1\), print Invalid
.
Sample code
#include <bits/stdc++.h>
using namespace std;
int main() {
int l, r;
cin >> l >> r;
if (l == 0 && r == 0) cout << "Invalid\n";
else if (l == 0 && r == 1) cout << "No\n";
else if (l == 1 && r == 0) cout << "Yes\n";
else cout << "Invalid\n";
}
posted:
last update: