mirror of
https://github.com/hao14293/2021-Postgraduate-408.git
synced 2026-07-27 00:30:59 +08:00
Create 1052.卖个萌.cpp
This commit is contained in:
36
PAT/PAT-B/CPP/1052.卖个萌.cpp
Normal file
36
PAT/PAT-B/CPP/1052.卖个萌.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
int main (){
|
||||
vector<vector<string> > v;
|
||||
for(int i = 0; i < 3; i++){
|
||||
string s;
|
||||
getline(cin, s);
|
||||
vector<string> row;
|
||||
int j = 0, k = 0;
|
||||
while(j < s.length()){
|
||||
if(s[j] == '['){
|
||||
while(k++ < s.length()){
|
||||
if(s[k] == ']'){
|
||||
row.push_back(s.substr(j+1, k-j-1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
v.push_back(row);
|
||||
}
|
||||
int n;
|
||||
cin >> n;
|
||||
for(int i = 0; i < n; i++){
|
||||
int a, b, c, d, e;
|
||||
cin >> a >> b >> c >> d >> e;
|
||||
if(a > v[0].size() || b > v[1].size() || c > v[2].size() || d > v[1].size() || e > v[0].size() || a < 1 || b < 1 || c < 1 || d < 1 || e < 1) {
|
||||
cout << "Are you kidding me? @\\/@" << endl;
|
||||
continue;
|
||||
}
|
||||
cout << v[0][a-1] << "(" << v[1][b-1] << v[2][c-1] << v[1][d-1] << ")" << v[0][e-1] << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user