码迷,mamicode.com
首页 > 其他好文 > 详细

1052 卖个萌

时间:2020-02-22 13:48:28      阅读:70      评论:0      收藏:0      [点我收藏+]

标签:ace   string   最小   mes   最大值   size   维数   二维数组   插入   

//坑点一,序号不存在,表示序号可能大于最大值,或者小于最小值。
//坑点二,输出转义字符\,用\\
注意点:二维数组vvs,只能插入一维数组vs,不能直接通过语法vvs[i].push_back(str)实现粒度插入。
#include<iostream>
#include<vector>
using namespace std;

vector<vector<string> > vvs;
int main() {
    string str;
    for(int i = 0; i < 3; ++i) {
        vector<string> vs;
        getline(cin,str);
        for(int j = 0; j < str.size(); ++j) {
            while(j < str.size() && str[j++] != [);
            string temp;
            while(j < str.size() && str[j] != ]) {//把[...]内的字符存放在temp中 
                temp += str[j];
                ++j;
            }
            vs.push_back(temp);
        }
        vvs.push_back(vs);
    }
    int k,left_hand,left_eye,mouth,right_eye,right_hand;
    cin>>k;
    while(k--) {
        cin>>left_hand>>left_eye>>mouth>>right_eye>>right_hand;
        if(left_hand < 1|| left_eye < 1 || mouth < 1 || right_eye < 1|| right_hand < 1
                || left_hand > vvs[0].size()|| left_eye > vvs[1].size() || mouth > vvs[2].size() || right_eye > vvs[1].size()|| right_hand > vvs[2].size())
            cout<<"Are you kidding me? @\\/@";//输出转义字符\,用\        else
            cout<<vvs[0][left_hand-1]<<"("<<vvs[1][left_eye-1]<<vvs[2][mouth-1]<<vvs[1][right_eye-1]<<")"<<vvs[0][right_hand-1]<<endl;
    }
    return 0;
}

技术图片

 

 

1052 卖个萌

标签:ace   string   最小   mes   最大值   size   维数   二维数组   插入   

原文地址:https://www.cnblogs.com/keep23456/p/12345023.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!