1052 卖个萌(测试点1,2)


solution

  • 想要输出\需要用\\才能输出,即
cpp 复制代码
cout << "Are you kidding me? @\\/@" << endl;
  • 测试点1,2:输入序号小于1的非法情况
cpp 复制代码
#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
	string s, ans, t;
	int k, cnt1 = 1, cnt2 = 1, cnt3 = 1, lh, rh, le, re, m;
	map<int, string> hands, eyes, mouths;
	for(int i = 0; i < 3; i++){
		getline(cin, s);
		for(int j = 0; j < s.size(); j = k + 1){
			if(s[j] == '['){
				for(k = j; s[k] != ']'; k++);
				if(i == 0) hands[cnt1++] = s.substr(j + 1, k - j - 1); 
				else if(i == 1) eyes[cnt2++] = s.substr(j + 1, k - j - 1);
				else mouths[cnt3++] = s.substr(j + 1, k - j - 1);
			}
			else k = j;
		}
	}
	cin >> k;
	while(k--){
		cin >> lh >> le >> m >> re >> rh;
		if(lh >= cnt1 || rh >= cnt1 || le >= cnt2 || re >= cnt2 || m >= cnt3 || lh <= 0 || le <= 0 || m <= 0 || re <= 0 || rh <= 0) cout << "Are you kidding me? @\\/@" << endl;
		else cout << hands[lh] + "(" + eyes[le] + mouths[m] + eyes[re] + ")"+ hands[rh] << endl;
	}
	return 0;
} 
相关推荐
有时间要学习16 分钟前
面试150——第二周
数据结构·算法·leetcode
liteblue40 分钟前
DEB包解包与打包笔记
linux·笔记
liu****43 分钟前
3.链表讲解
c语言·开发语言·数据结构·算法·链表
第二只羽毛1 小时前
C++ 高性能编程要点
大数据·开发语言·c++·算法
CQ_YM2 小时前
数据结构之栈
数据结构·算法·
崇山峻岭之间2 小时前
C++ Prime Plus 学习笔记027
c++·笔记·学习
爱学习的梵高先生2 小时前
C++:基础知识
开发语言·c++·算法
IMPYLH2 小时前
Lua 的 tonumber 函数
开发语言·笔记·后端·junit·游戏引擎·lua
xlq223222 小时前
24.map set(下)
数据结构·c++·算法
Xudde.2 小时前
BabyPass靶机渗透
笔记·学习·安全·web安全