跳到正文

题解

题解:P14124 [SCCPC 2021] Nihongo wa Muzukashii Desu

MelancholyZ约 1 分钟
原文

这是 2025年10月2日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P14124

版本

  1. v2当前
  2. v1

签到题。按题意进行模拟即可。

赛时AC代码如下

C++
#include<bits/stdc++.h>

using namespace std;

const int Maxn = 1e6 + 5;

vector<pair<string, string>> strmd = {
	{"shimasu","shite"},{"chimasu","tte"},{"rimasu","tte"},
	{"mimasu","nde"},{"bimasu","nde"},{"nimasu","nde"},
	{"kimasu","ite"},{"gimasu","ide"},{"imasu","tte"} };


int main(){
	int T;  cin >> T;
	while(T --){
		string str;
		cin >> str;
		if(str == "ikimasu"){
			cout << "itte" << '\n';
			continue;
		}
		
		for(auto s : strmd){
			int tmp = str.length() - s.first.length();
			if(tmp <= 0) continue;
			if(str.substr(tmp) == s.first){
				cout << str.substr(0, str.length() - s.first.length()) + s.second << '\n';
				break;
			}
		}
	}
	return 0;
}