#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <sstream>
using namespace std;
char La[26]={'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9','9'};
int La2[26]={1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4};
int L[13];
int L3[1004];
int main(){
int y,brp;
for (int i=1;i<10;i++){
cin >> y;
L[i]=y;
}
string S,z;
char prbr='*',a;
cin >> S;
int x=S.length();
for (int i=0;i<x;i++){
a=S[i];
brp=La2[(int)a-97];
if (prbr==La[(int)a-97]){
z+='#';
}
else prbr=La[(int)a-97];
for (int j=0;j<brp;j++){
z+=La[(int)a-97];
}
}
char d;
string L2[1004];
int e=z.length();
for (int i=1;i<=9;i++){
for (int j=0;j<e;j++){
string str= to_string(L[i]);
string stri= to_string(i);
if (z[j]==str[0] && L3[j]!=1){
L2[j]=stri;
L3[j]=1;
}
else if (z[j]!=str[0] && L3[j]!=1){
L2[j]=z[j];
}
}
}
for (int i=0;i<e;i++){
cout << L2[i];
}
return 0;
}
Compilation message
mobitel.cpp: In function 'int main()':
mobitel.cpp:35:10: warning: unused variable 'd' [-Wunused-variable]
char d;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |