QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323330 | #6768. Nihongo wa Muzukashii Desu | Rico64 | AC ✓ | 0ms | 3616kb | C++20 | 916b | 2024-02-09 09:54:54 | 2024-02-09 09:54:55 |
Judging History
answer
#include <iostream>
using namespace std;
bool endswith(const string& s, const string& t) {
return s.length() >= t.length() && s.substr(s.length() - t.length()) == t;
}
pair<string,string> laws[] {
{"chimasu", "tte"},
{"shimasu", "shite"},
{"rimasu", "tte"},
{"mimasu", "nde"},
{"bimasu", "nde"},
{"nimasu", "nde"},
{"kimasu", "ite"},
{"gimasu", "ide"},
{"imasu", "tte"},
};
void solve() {
string s;
cin >> s;
if (s == "ikimasu") {
cout << "itte" << endl;
return;
}
for (const auto& p : laws) {
if (endswith(s, p.first)) {
cout << s.substr(0, s.length() - p.first.length()) << p.second << endl;
return;
}
}
cout << "WA" << endl;
}
int main() {
int t;
cin >> t;
while (t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
10 machimasu kaerimasu nomimasu yobimasu shinimasu kakimasu ikimasu kikimasu isogimasu kashimasu
output:
matte kaette nonde yonde shinde kaite itte kiite isoide kashite
result:
ok 10 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
63 machimasu kaerimasu nomimasu yobimasu shinimasu kakimasu ikimasu isogimasu kashimasu hatarakimasu yasumimasu owarimasu yomimasu kikimasu torimasu okurimasu kirimasu karimasu arimasu kakarimasu asobimasu oyogimasu kawakimasu sukimasu mochimasu hanashimasu hurimasu hairimasu suwarimasu tachimasu ke...
output:
matte kaette nonde yonde shinde kaite itte isoide kashite hataraite yasunde owatte yonde kiite totte okutte kitte katte atte kakatte asonde oyoide kawaite suite motte hanashite hutte haitte suwatte tatte keshite shitte sunde omoikishite oite utte tsukutte notte oshite oroshite dashite kaeshite meide...
result:
ok 63 lines