# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
13839 | kipa00 | 고장난 휴대전화기 (COCI14_mobitel) | C++98 | 0 ms | 1580 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <string>
using std::string;
string res;
string tonum[26] = {"2","22","222","3","33","333","4","44","444","5","55","555","6","66","666","7","77","777","7777","8","88","888","9","99","999","9999"};
void add(string str) {
if (res.length() == 0) {
res += str;
} else if (res[res.length() - 1] == str[0]) {
res += "#" + str;
} else {
res += str;
}
}
int main() {
int arr[9];
char str[105], *ptr = str;
int n;
for (n=0; n<9; ++n) {
int temp;
scanf("%d", &temp);
arr[temp - 1] = n + 1;
}
scanf("%s", str);
for (;*ptr;++ptr) {
add(tonum[*ptr - 'a']);
}
for (n=0;n<res.length();++n) {
if ('2' <= res[n] && res[n] <= '9') {
printf("%d", arr[res[n] - '1']);
} else printf("#");
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |