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;
} 
相关推荐
.千余13 小时前
【C++】C++ set 与 multiset 完全指南:关联式容器入门
开发语言·c++·笔记·学习·其他
南境十里·墨染春水20 小时前
C++ 工厂模式:从入门到进阶,彻底掌握对象创建的艺术
开发语言·c++·算法
@insist12320 小时前
系统架构设计师-实时性评价、调度算法与内核架构选型
算法·架构·系统架构·软考·系统架构设计师·软件水平考试
一只齐刘海的猫1 天前
【Leetcode】找到字符串中所有字母异位词
算法·leetcode·职场和发展
海清河晏1111 天前
数据结构 | 八大排序
数据结构·算法·排序算法
IronMurphy1 天前
【算法五十七】146. LRU 缓存
算法·缓存
三品吉他手会点灯1 天前
STM32F103 学习笔记-24-I2C-读写EEPROM(第1节)-I2C物理层介绍
笔记·stm32·学习
凌波粒1 天前
LeetCode--108.将有序数组转换为二叉搜索树(二叉树)
算法·leetcode·职场和发展
liulilittle1 天前
KCC:在 BBR 思路上的一次探索
网络·tcp/ip·算法·bbr·通信·拥塞控制·kcc