Official
A - Saturday Editorial by en_translator
This problem is an exercise of if statements and comparing strings.
The following is sample code in C++ and Python for reference.
Sample Code (C++)
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
if (s == "Monday") {
cout << 5 << '\n';
} else if (s == "Tuesday") {
cout << 4 << '\n';
} else if (s == "Wednesday") {
cout << 3 << '\n';
} else if (s == "Thursday") {
cout << 2 << '\n';
} else {
cout << 1 << '\n';
}
return 0;
}
Sample Code (Python)
s = input()
if s == "Monday":
print(5)
elif s == "Tuesday":
print(4)
elif s == "Wednesday":
print(3)
elif s == "Thursday":
print(2)
else:
print(1)
posted:
last update: