QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323330#6768. Nihongo wa Muzukashii DesuRico64AC ✓0ms3616kbC++20916b2024-02-09 09:54:542024-02-09 09:54:55

Judging History

你现在查看的是最新测评结果

  • [2024-02-09 09:54:55]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3616kb
  • [2024-02-09 09:54:54]
  • 提交

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