#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <string.h>
#include <map>
#include <vector>
using namespace std;
char s[110], w[200];
int x, l[20], p, a, b;
vector <int> v[11];
bool z = false;
int main() {
int y = 'a';
for (int i = 2; i < 10; i++){
if(i == 7 or i == 9){
for (int j = 0; j < 4; j++){
v[i].push_back(y);
y++;
}
continue;
}
for (int j = 0; j < 3; j++){
v[i].push_back(y);
y++;
}
}
/*for (int i = 2; i < 10; i++){
cout << i << " ";
for (int j = 0; j < v[i].size(); j++){
cout << v[i][j] << " ";
}
cout << endl;
}*/
for (int i = 1; i < 10; i++){
cin >> l[i];
}
cin >> s;
y = 'a';
x = s[0];
z = false;
/*cout << "x = "<< x << " ";*/
for (int i = 2; i < 10; i++){
/*cout << s << 1 << endl;*/
if(i == 7 or i == 9){
for (int j = 0; j < 4; j++){
if (v[i][j] == x){
z = true;
a = i; b = j;
/*cout << "a, b = " << a << " " << b << endl;*/
break;
}
}
continue;
}
for (int j = 0; j < 3; j++){
if (v[i][j] == x){
z = true;
a = i; b = j;
/*cout << "a, b = " << a << " " << b << endl;*/
break;
}
}
if (z) break;
}
p = a;
for (int i = 0; i < b+1; i++){
/*cout << l[a];*/
/*cout << a;*/
/*cout << endl;*/
for (int i = 1; i < 10; i++){
if (l[i] == a){
cout << i; break;
}
}
}
for (int i = 1; i < strlen(s); i++){
x = s[i];
z = false;
/*cout << "x = " << x << " ";*/
for (int i = 2; i < 10; i++){
/*cout << s << 2 << endl;*/
if(i == 7 or i == 9){
for (int j = 0; j < 4; j++){
if (v[i][j] == x){
z = true;
a = i; b = j;
/*cout << "a, b = " << a << " " << b << endl;*/
break;
}
}
continue;
}
for (int j = 0; j < 3; j++){
if (v[i][j] == x){
z = true;
a = i; b = j;
/*cout << "a, b = " << a << " " << b << endl;*/
break;
}
}
if (z) break;
}
if (p == a) cout << "#";
p = a;
for (int i = 0; i < b+1; i++){
/*cout << l[a];*/
/*cout << a;*/
/*cout << endl;*/
for (int i = 1; i < 10; i++){
if (l[i] == a){
cout << i; break;
}
}
}
}
return 0;
}
Compilation message
mobitel.cpp: In function 'int main()':
mobitel.cpp:95:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i < strlen(s); i++){
~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
360 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
3 ms |
536 KB |
Output is correct |
5 |
Correct |
2 ms |
708 KB |
Output is correct |
6 |
Correct |
2 ms |
708 KB |
Output is correct |
7 |
Correct |
2 ms |
708 KB |
Output is correct |
8 |
Correct |
2 ms |
708 KB |
Output is correct |
9 |
Correct |
2 ms |
708 KB |
Output is correct |
10 |
Correct |
2 ms |
708 KB |
Output is correct |