QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#671624#6768. Nihongo wa Muzukashii DesuACAAA#AC ✓0ms3880kbC++231.2kb2024-10-24 13:45:412024-10-24 13:45:41

Judging History

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

  • [2024-10-24 13:45:41]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3880kb
  • [2024-10-24 13:45:41]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char* suffix[10]={"chimasu","rimasu","mimasu","bimasu","nimasu","kimasu","gimasu","shimasu","imasu"};//后缀
int main()
{
    int t;
    char word[30];
    scanf("%d",&t);
    char *p;
    while(t--)
    {
        scanf("%s",word);
        if(!strcmp(word,"ikimasu"))
            {printf("itte\n");continue;}
        int i;
        for(i=0;i<9;i++)
        {
            if(strstr(word,suffix[i]))
            {
                p=strstr(word,suffix[i]);//用strstr函数寻找子串(后缀),若找到,返回子串所在的指针,若找不到,返回NULL
                break;
            }
        }
        int T=i+1;
        char prefix[25];//前缀
        int t=p-word;
        for(i=0;i<t;i++)
        {
            prefix[i]=word[i];
        }
        prefix[i]='\0';
        if(T>=1&&T<=2) printf("%stte\n",prefix);
        else if(T>2&&T<=5) printf("%snde\n",prefix);
        else if(T==6) printf("%site\n",prefix);
        else if(T==7) printf("%side\n",prefix);
        else if(T==8) printf("%sshite\n",prefix);
        else if(T==9) printf("%stte\n",prefix);
    }
    return 0;
}


详细

Test #1:

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

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: 3880kb

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