#include <bits/stdc++.h>
using namespace std;
int main () {
vector<string> touches = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
map<char, string> letters;
for (int k = 1; k <= 9; k++) {
int num; cin >> num;
for (int i = 1; i <= touches[num].size(); i++) {
letters[touches[num][i-1]] = "";
for (int j = 0; j < i; j++) letters[touches[num][i-1]] += char(int('0') + k);
}
}
int last = '0';
string message; cin >> message;
for (auto c: message) {
if (letters[c][0] == last) cout << "#";
cout << letters[c];
last = letters[c][0];
}
cout << '\n';
}
Compilation message
mobitel.cpp: In function 'int main()':
mobitel.cpp:10:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
10 | for (int i = 1; i <= touches[num].size(); i++) {
| ~~^~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
304 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
300 KB |
Output is correct |