QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#251830#6768. Nihongo wa Muzukashii Desuhaze#AC ✓1ms3572kbC++201.7kb2023-11-15 10:08:082023-11-15 10:08:09

Judging History

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

  • [2023-11-15 10:08:09]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3572kb
  • [2023-11-15 10:08:08]
  • 提交

answer

/*
Author: haze
2023/11/15
09:58
*/

#include <bits/stdc++.h>

#define irep(i, l, r) for(int (i) = (l); (i) <= (r); ++(i))
#define drep(i, r, l) for(int (i) = (r); (i) >= (l); --(i))
#define ll long long
#define LL __int128
using namespace std;

inline ll read() {
    char ch = getchar();
    ll s = 0;
    bool w = 0;
    while (!isdigit(ch)) {
        if (ch == '-')w = 1;
        ch = getchar();
    }
    while (isdigit(ch))s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
    return w ? -s : s;
}

inline char rc() {
    char ch = getchar();
    while (1) {
        if (ch >= '!' && ch <= '~')return ch;
        ch = getchar();
    }
}

template<class T1, class T2>
T1 min(T1 AA, T2 BB) { return AA > BB ? BB : AA; }

template<class T1, class T2>
T1 max(T1 AA, T2 BB) { return AA < BB ? BB : AA; }

const int itinf = 1e9;
const ll llinf = 4e18;
const int mod = 1000000007;
const int N = 500009;
map<string, string> f =
        {
                {"shimasu", "shite"},
                {"gimasu", "ide"},
                {"chimasu", "tte"},
                {"rimasu", "tte"},
                {"mimasu", "nde"},
                {"bimasu", "nde"},
                {"nimasu", "nde"},
                {"kimasu", "ite"}

        };
int main() {
    int n = read();
    while(n --){
        string s, t;
        cin >> s;
        if(s == "ikimasu"){
            puts("itte");
            continue;
        }
        while(s.size()){
            if(f.contains(s)){
                cout << t << f[s] << '\n';
                break;
            }
            t += s[0];
            s.erase(s.begin());
        }
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3536kb

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: 1ms
memory: 3572kb

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