110852024-07-06 21:02:38GervidMorze (60 pont)cpp17Accepted 60/603ms504 KiB
#include <iostream>
#include <cstdio>

int main()
{
	std::cin.tie(nullptr);
	std::ios::sync_with_stdio(false);

	char buffer[1001];
	int i = 0;

	std::cin.getline(buffer, 1001);

	char output[201];
	int j = 0;

    while (buffer[i] != '\0')
    {
        char morse_digit = (((buffer[i] == '-') << 4) | ((buffer[i + 1] == '-') << 3) | ((buffer[i + 2] == '-') << 2) | ((buffer[i + 3] == '-') << 1) | (buffer[i + 4] == '-'));
        i += 5;
        switch (morse_digit)
        {
            case char(0b11111) : output[j++] = '0'; break;
            case char(0b01111) : output[j++] = '1'; break;
            case char(0b00111) : output[j++] = '2'; break;
            case char(0b00011) : output[j++] = '3'; break;
            case char(0b00001) : output[j++] = '4'; break;
            case char(0) :       output[j++] = '5'; break;
            case char(0b10000) : output[j++] = '6'; break;
            case char(0b11000) : output[j++] = '7'; break;
            case char(0b11100) : output[j++] = '8'; break;
            case char(0b11110) : output[j++] = '9'; break;
        }
    }

	output[j] = '\0';
	std::printf("%s\n", output);

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base60/60
1Accepted0/02ms356 KiB
2Accepted0/03ms356 KiB
3Accepted3/33ms376 KiB
4Accepted3/33ms348 KiB
5Accepted3/32ms360 KiB
6Accepted3/33ms284 KiB
7Accepted3/33ms504 KiB
8Accepted3/32ms376 KiB
9Accepted4/43ms504 KiB
10Accepted4/43ms356 KiB
11Accepted4/43ms356 KiB
12Accepted7/73ms504 KiB
13Accepted7/72ms376 KiB
14Accepted8/82ms504 KiB
15Accepted8/82ms352 KiB