Submission #60941

#TimeUsernameProblemLanguageResultExecution timeMemory
609410xrgbMobitel (COCI14_mobitel)C++11
50 / 50
2 ms756 KiB
#include <cstdio> int D[10]; char msg[128]; constexpr int T[][2] = { {2, 1}, {2, 2}, {2, 3}, {3, 1}, {3, 2}, {3, 3}, {4, 1}, {4, 2}, {4, 3}, {5, 1}, {5, 2}, {5, 3}, {6, 1}, {6, 2}, {6, 3}, {7, 1}, {7, 2}, {7, 3}, {7, 4}, {8, 1}, {8, 2}, {8, 3}, {9, 1}, {9, 2}, {9, 3}, {9, 4}, }; int main() { for (int i = 1; i <= 9; ++i) { int x; scanf("%d", &x); D[x] = i; } scanf("%s", msg); for (int i = 0; msg[i]; ++i) { const int ma = msg[i] - 'a'; if (i >= 1 && T[ma][0] == T[msg[i - 1] - 'a'][0]) putchar('#'); for (int i = 0, j = T[ma][1], k = D[T[ma][0]]; i < j; ++i) putchar('0' + k); } puts(""); }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
   ~~~~~^~~~~~~~~~
mobitel.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", msg);
  ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...