Official
A - 9x9 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.
This problem requires input and output of integers and strings, and arithmetic operations of integers.
Note that this problem asks to accept input containing both digits and characters. For example, we can do as follows:
- Receive the three character as a single string.
- Find the value when regarding the \(1\)-st character as a digit, and store it as \(A\).
- Find the value when regarding the \(3\)-rd character as a digit, and store it as \(B\).
- Print \(A\times B\).
For more details on implementation in C++ and Python, refer to the sample code below.
Sample code (C++)
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s; // Receive the input
int a = (s[0] - '0'); // The value of the 1-st character
int b = (s[2] - '0'); // The value of the 3-rd character
cout << a * b << endl;
}
Sample code (Python)
s = input() # Receive the input
a = int(s[0]) # The value of the 1-st character
b = int(s[2]) # The value of the 3-rd character
print(a * b)
posted:
last update: