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;
} 
相关推荐
时兮兮时几秒前
CALIPSO垂直特征掩膜(VFM)—使用python绘制主类型、气溶胶和云的子类型
笔记·python·calipso
千金裘换酒几秒前
LeetCode 回文链表
算法·leetcode·链表
CSDN_RTKLIB1 分钟前
【std::map】与std::unordered_map差异
算法·stl·哈希算法
FL171713142 分钟前
Geometric Control
人工智能·算法
时兮兮时4 分钟前
MODIS Land Cover (MCD12Q1 and MCD12C1) Product—官方文档的中文翻译
笔记·mcd12q1
老鼠只爱大米5 分钟前
LeetCode算法题详解 283:移动零
算法·leetcode·双指针·快慢指针·移动零·move zeroes
过河卒_zh15667669 分钟前
喜讯:第十五批生成合成类算法备案备案号公布
人工智能·算法·aigc·生成式人工智能·算法备案
cpp_250113 分钟前
B3927 [GESP202312 四级] 小杨的字典
数据结构·c++·算法·题解·洛谷
Cx330❀16 分钟前
《C++ 递归、搜索与回溯》第2-3题:合并两个有序链表,反转链表
开发语言·数据结构·c++·算法·链表·面试
AI科技星17 分钟前
电磁耦合常数Z‘的第一性原理推导与严格验证:张祥前统一场论的几何基石
服务器·人工智能·线性代数·算法·矩阵