7532 2024. 01. 09 13:33:07 tamasmark Morze (60 pont) cpp17 Elfogadva 60/60 3ms 3728 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
Részfeladat Összpont Teszt Verdikt Idő Memória
base 60/60
1 Elfogadva 0/0 3ms 1876 KiB
2 Elfogadva 0/0 3ms 2124 KiB
3 Elfogadva 3/3 3ms 2332 KiB
4 Elfogadva 3/3 3ms 2572 KiB
5 Elfogadva 3/3 3ms 2736 KiB
6 Elfogadva 3/3 3ms 2952 KiB
7 Elfogadva 3/3 3ms 3156 KiB
8 Elfogadva 3/3 3ms 3212 KiB
9 Elfogadva 4/4 3ms 3340 KiB
10 Elfogadva 4/4 3ms 3420 KiB
11 Elfogadva 4/4 3ms 3428 KiB
12 Elfogadva 7/7 3ms 3684 KiB
13 Elfogadva 7/7 3ms 3508 KiB
14 Elfogadva 8/8 3ms 3636 KiB
15 Elfogadva 8/8 3ms 3728 KiB