1052 卖个萌

萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的:

[左手]([左眼][口][右眼])[右手]

现给出可选用的符号集合,请你按用户的要求输出表情。

输入格式:

输入首先在前三行顺序对应给出手、眼、口的可选符号集。每个符号括在一对方括号 []内。题目保证每个集合都至少有一个符号,并不超过 10 个符号;每个符号包含 1 到 4 个非空字符。

之后一行给出一个正整数 K,为用户请求的个数。随后 K 行,每行给出一个用户的符号选择,顺序为左手、左眼、口、右眼、右手——这里只给出符号在相应集合中的序号(从 1 开始),数字间以空格分隔。

输出格式:

对每个用户请求,在一行中输出生成的表情。若用户选择的序号不存在,则输出 Are you kidding me? @\/@

输入样例:

[╮][╭][o][~\][/~]  [<][>]
[╯][╰][^][-][=][>][<][@][⊙]
[Д][▽][_][ε][^] ...
4
1 1 2 2 2
6 8 1 5 5
3 3 4 3 3
2 10 3 9 3

输出样例:

╮(╯▽╰)╭
<(@Д=)/~
o(^ε^)o
Are you kidding me? @\/@   题解:我发现这几道题是真的坑,这道题主要有两个坑点:
  ①"Are you kidding me? @\/@"需要写成"Are you kidding me? @\\/@",因为\是转义符号。
  ②输出"Are you kidding me? @\\/@"时,用户给出的不一定是大于这个数据的数据量,也有可能是0或负数
  这道题还需要注意处理输入的问题,用判断[的方式来输入我个人觉得是一个比较好的方法。
代码如下:
 #include<iostream>
#include<string> using namespace std; int get( string temp, string a[])
{
int k = ;
for( int i = ; i < temp.length(); i++){
if( temp[i] == '['){
i++;
while(temp[i] != ']'){
a[k] += temp[i];
i++;
}
k++;
}
}
return k;
} int main()
{
int k, temp[];
string mouth, eye, hand;
string a[], b[], c[];
getline( cin, hand);
getline( cin, eye);
getline( cin, mouth);
int len1 = get( hand, a);
int len2 = get( eye, b);
int len3 = get( mouth, c); scanf("%d",&k);
while(k--){
bool temp3 = true;
for( int i = ; i < ; i++){
scanf("%d",&temp[i]);
}
if( temp[] > len1 || temp[] < )
temp3 = false;
else if( temp[] > len2 || temp[] < )
temp3 = false;
else if( temp[] > len3 || temp[] < )
temp3 = false;
else if( temp[] > len2 || temp[] < )
temp3 = false;
else if( temp[] > len1 || temp[] < )
temp3 = false;
if( !temp3){
cout << "Are you kidding me? @\\/@" << endl;
continue;
}
else{
cout<<a[temp[]-]<<"("<<b[temp[]-]<<c[temp[]-]<<b[temp[]-]<<")"<<a[temp[]-]<<endl;
}
}
return ;
}
 

最新文章

  1. [LeetCode] Arithmetic Slices II - Subsequence 算数切片之二 - 子序列
  2. js设置css样式.
  3. 关于用bootstrap显示查询的后台数据
  4. CF 484E - Sign on Fence
  5. for-in遍历json数据
  6. HTML5+AJAX+WEBAPI 文件上传
  7. AspNetCore.Hosting
  8. 三款经常使用IP发包工具介绍
  9. Excel单元格所在的行和列变色
  10. cocos2d-x action执行完毕的回调
  11. 机器学习(五)--------正则化(Regularization)
  12. 使用Git进行代码管理的心得--github for windows
  13. 脚本监控web服务器,工作不正常发邮件提醒
  14. 登录rabbitmq报错User can only log in via localhost
  15. vs2015 dx15开发教程一
  16. NetBpm XML解读(5)
  17. 【HAOI2013】花卉节
  18. Liunx cannot remove `xxx&#39;: Operation not permitted
  19. kafka启动出现:Unsupported major.minor version 52.0 错误
  20. 【bzoj2272】[Usaco2011 Feb]Cowlphabet 奶牛文字 dp

热门文章

  1. GYM 101889F(树状数组)
  2. 利用Common-Fileupload上传文件图片
  3. 105 Construct Binary Tree from Preorder and Inorder Traversal 从前序与中序遍历序列构造二叉树
  4. 数据库 join
  5. 一个普通Java程序包含哪些线程??
  6. 日常博客-png,jpeg,gif图片
  7. css水平垂直居中的几个方法和技巧/居中之美
  8. svn merge当主干修改后合并分支
  9. 剑指offer——把字符串转换成整数(c++)
  10. 如何在Ubuntu 16.04上安装Apache Web服务器