QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#671624 | #6768. Nihongo wa Muzukashii Desu | ACAAA# | AC ✓ | 0ms | 3880kb | C++23 | 1.2kb | 2024-10-24 13:45:41 | 2024-10-24 13:45:41 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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