75322024-01-09 13:33:07tamasmarkMorze (60 pont)cpp17Accepted 60/603ms3728 KiB
// morze.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>

using namespace std;

string egy = ".----", ketto="..---",harom="...--",negy="....-",ot=".....";
string hat = "-....", het = "--...", nyolc = "---..", kilenc = "----.", nulla = "-----";
bool egyb,kettob,haromb,negyb,otb,hatb,hetb,nyolcb,kilencb,nullab;
string s;

int main()
{
    getline(cin, s);
    for (int i = 0; i < s.size(); ++i)
    {
            if (egy[i % 5] != s[i]) egyb = true;
            if (ketto[i % 5] != s[i]) kettob = true;
            if (harom[i % 5] != s[i]) haromb = true;
            if (negy[i % 5] != s[i]) negyb = true;
            if (ot[i % 5] != s[i]) otb = true;
            if (hat[i % 5] != s[i]) hatb = true;
            if (het[i % 5] != s[i]) hetb = true;
            if (nyolc[i % 5] != s[i]) nyolcb = true;
            if (kilenc[i % 5] != s[i]) kilencb = true;
            if (nulla[i % 5] != s[i]) nullab = true;

        if (i % 5 == 4)
        {
            if (!egyb) cout << "1";
            else if (!kettob) cout << "2";
            else if (!haromb) cout << "3";
            else if (!negyb) cout << "4";
            else if (!otb) cout << "5";
            else if (!hatb) cout << "6";
            else if (!hetb) cout << "7";
            else if (!nyolcb) cout << "8";
            else if (!kilencb) cout << "9";
            else if (!nullab) cout << "0";
            egyb = false;
            kettob = false;
            haromb = false;
            negyb = false;
            otb = false;
            hatb = false;
            hetb = false;
            nyolcb = false;
            kilencb = false;
            nullab = false;

        }
    }
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base60/60
1Accepted0/03ms1876 KiB
2Accepted0/03ms2124 KiB
3Accepted3/33ms2332 KiB
4Accepted3/33ms2572 KiB
5Accepted3/33ms2736 KiB
6Accepted3/33ms2952 KiB
7Accepted3/33ms3156 KiB
8Accepted3/33ms3212 KiB
9Accepted4/43ms3340 KiB
10Accepted4/43ms3420 KiB
11Accepted4/43ms3428 KiB
12Accepted7/73ms3684 KiB
13Accepted7/73ms3508 KiB
14Accepted8/83ms3636 KiB
15Accepted8/83ms3728 KiB