Official
A - Saturday Editorial by KoD
この問題は if 文や文字列の比較の練習問題となっています。
C++ および Python での実装例を以下に示したので、参考にしてください。
実装例 (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;
}
実装例 (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: