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;
} 
相关推荐
DoraBigHead37 分钟前
小哆啦解题记——两数失踪事件
前端·算法·面试
不太可爱的大白37 分钟前
Mysql分片:一致性哈希算法
数据库·mysql·算法·哈希算法
Tiandaren5 小时前
Selenium 4 教程:自动化 WebDriver 管理与 Cookie 提取 || 用于解决chromedriver版本不匹配问题
selenium·测试工具·算法·自动化
岁忧6 小时前
(LeetCode 面试经典 150 题 ) 11. 盛最多水的容器 (贪心+双指针)
java·c++·算法·leetcode·面试·go
chao_7896 小时前
二分查找篇——搜索旋转排序数组【LeetCode】两次二分查找
开发语言·数据结构·python·算法·leetcode
陈洪奇6 小时前
注册中心学习笔记整理
笔记·学习
秋说8 小时前
【PTA数据结构 | C语言版】一元多项式求导
c语言·数据结构·算法
Maybyy8 小时前
力扣61.旋转链表
算法·leetcode·链表
兴趣使然_9 小时前
【笔记】使用 html 创建网址快捷方式
笔记·html·js
卡卡卡卡罗特10 小时前
每日mysql
数据结构·算法