# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31177 | foul3r | Mobitel (COCI14_mobitel) | C++14 | 0 ms | 2020 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 <bits/stdc++.h>
int inp[15], print[15];
int key[] = {0, 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 num[] = {0, 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};
char dap[1010];
int dpt;
int main()
{
int i, j, l, id, r;
char s[110];
for(i=1;i<=9;i++){
scanf("%d", &inp[i]);
print[inp[i]]=i;
}
scanf("%s", s+1);
l = strlen(s+1);
for(i=1;i<=l;i++)
{
s[i] = s[i]-'a'+1;
if(num[s[i]]%10 == num[s[i-1]]%10) dap[++dpt]='#';
for(j=1;j<=key[s[i]];j++)
{
dap[++dpt]=num[s[i]]+48;
}
}
for(i=1;i<=dpt;i++)
{
if(dap[i]>='0' && dap[i]<='9') printf("%d", print[dap[i]-48]);
else printf("%c", dap[i]);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |