# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
392818 | rainboy | Mobitel (COCI14_mobitel) | C11 | 1 ms | 208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <string.h>
#define N 100
int aa[] = { 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 kk[] = { 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 main() {
static int ii[10];
static char cc[N + 1], ans[N * 5 + 1];
int n, h, i, cnt;
for (i = 1; i <= 9; i++) {
int a;
scanf("%d", &a);
ii[a] = i;
}
scanf("%s", cc), n = strlen(cc);
cnt = 0;
for (i = 0; i < n; i++) {
int c = cc[i] - 'a';
if (i > 0 && aa[c] == aa[cc[i - 1] - 'a'])
ans[cnt++] = '#';
for (h = 0; h < kk[c]; h++)
ans[cnt++] = ii[aa[c]] + '0';
}
printf("%s\n", ans);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |