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;
} 
相关推荐
:-)1 天前
算法-归并排序
java·开发语言·数据结构·算法·排序算法
Jerry1 天前
LeetCode 101. 对称二叉树
算法
hengcaib1 天前
防封号电销外包公司怎么选合规线路与风控核查方法
笔记
可编程芯片开发1 天前
基于MPPT最大功率跟踪的离网光伏发电系统Simulink建模与仿真
算法
AI科技星1 天前
线性算子不是空间映射函数,是全域双螺旋场之间拉伸、旋转、耦合、坍缩的跨空间标准化变换载体《全域数学vs传统数学:人类文明进阶200讲》第80讲
线性代数·算法·矩阵·数据挖掘·回归·乖乖数学·全域数学
米罗篮1 天前
矩阵快速幂 (Exponentiation By Squaring Applied To Matrices)
c++·线性代数·算法·矩阵
dream_home84071 天前
图像算法模型NPU适配与算法服务实战指南
人工智能·python·算法·npu 图像服务
大鱼>1 天前
多宠物家庭智能管理平台:云端架构与多设备协同实战
python·算法·iot·宠物
To_OC1 天前
LC 22 括号生成:刷完这道题,我终于搞懂回溯剪枝了
javascript·算法·leetcode
To_OC1 天前
LC 39 组合总和:回溯入门必刷题,我踩过的两个坑都在这了
javascript·算法·leetcode