#include <bits/stdc++.h>
using namespace std;
int n;
int d;
int main()
{
ios_base::sync_with_stdio(false);
vector<int> cnt(10);
for(int i = 1; i <= 9; i ++){
int x;
cin >> x;
cnt[x] = i;
}
map<char, pair<int, int>> t;
t['a'] = {2, 1}, t['b'] = {2, 2}, t['c'] = {2, 3};
t['d'] = {3, 1}, t['e'] = {3, 2}, t['f'] = {3, 3};
t['g'] = {4, 1}, t['h'] = {4, 2}, t['i'] = {4, 3};
t['j'] = {5, 1}, t['k'] = {5, 2}, t['l'] = {5, 3};
t['m'] = {6, 1}, t['n'] = {6, 2}, t['o'] = {6, 3};
t['p'] = {7, 1}, t['q'] = {7, 2}, t['r'] = {7, 3}, t['s'] = {7, 4};
t['t'] = {8, 1}, t['u'] = {8, 2}, t['v'] = {8, 3};
t['w'] = {9, 1}, t['x'] = {9, 2}, t['y'] = {9, 3}, t['z'] = {9, 4};
string s;
cin >> s;
int last = -1;
for(int i = 0; i < (int)s.size(); i ++){
pair<int, int> cur = t[s[i]];
if(cur.first == last) cout << '#';
cout << string(cur.second, cnt[cur.first] + '0');
last = cur.first;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |