Submission #392818

#TimeUsernameProblemLanguageResultExecution timeMemory
392818rainboyMobitel (COCI14_mobitel)C11
50 / 50
1 ms208 KiB
#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)

mobitel.c: In function 'main':
mobitel.c:17:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   17 |   scanf("%d", &a);
      |   ^~~~~~~~~~~~~~~
mobitel.c:20:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   20 |  scanf("%s", cc), n = strlen(cc);
      |  ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...