#1954: I will give you the answer but one chicken cover(雞包)


1753980-3@g.puiching.edu.mo (P5A31蒲雋浠)

School : No School
ID : 2571
IP address : [192.168.120.33]
Last Login :
2025-05-22 13:39:17
b385. 摩斯電碼的秘密 | From: [192.168.120.33] | Post Date : 2025-04-15 18:43

#include <iostream>
#include <string>
#include <unordered_map>
#include <sstream>
#include <vector>

using namespace std;

int main() {
    unordered_map<string, char> morseToDigit = {
        {"-----", '0'},
        {".----", '1'},
        {"..---", '2'},
        {"...--", '3'},
        {"....-", '4'},
        {".....", '5'},
        {"-....", '6'},
        {"--...", '7'},
        {"---..", '8'},
        {"----.", '9'}
    };
    
    string input;
    getline(cin, input);
    istringstream iss(input);
    string morseCode;
    string result;
    
    while (iss >> morseCode) {
        if (morseToDigit.find(morseCode) != morseToDigit.end()) {
            result += morseToDigit[morseCode];
        }
    }
    
    cout << result << endl;
    
    return 0;
}
 
#1966: Re:I will give you the answer but one chicken cover(雞包)


1755143-9@g.puiching.edu.mo (P5A35蔡雋言)

School : Pui Ching Middle School
ID : 3019
IP address : [192.168.120.33]
Last Login :
2025-05-05 14:32:19
b385. 摩斯電碼的秘密 | From: [192.168.120.33] | Post Date : 2025-04-21 21:22

#include<bits/stdc++.h>
using namespace std; int main() { unordered_map<string, char> morseToDigit = { {"-----", '0'}, {".----", '1'}, {"..---", '2'}, {"...--", '3'}, {"....-", '4'}, {".....", '5'}, {"-....", '6'}, {"--...", '7'}, {"---..", '8'}, {"----.", '9'} }; string input; getline(cin, input); istringstream iss(input); string morseCode; string result; while (iss >> morseCode) { if (morseToDigit.find(morseCode) != morseToDigit.end()) { result += morseToDigit[morseCode]; } } cout << result << endl; return 0; }

TOO EZ QUESTION YOU USE AI LOL

 
#2054: Re:I will give you the answer but one chicken cover(雞包)


1753980-3@g.puiching.edu.mo (P5A31蒲雋浠)

School : No School
ID : 2571
IP address : [192.168.120.33]
Last Login :
2025-05-22 13:39:17
b385. 摩斯電碼的秘密 | From: [192.168.120.33] | Post Date : 2025-05-12 19:16

#include<bits/stdc++.h>
using namespace std; int main() { unordered_map<string, char> morseToDigit = { {"-----", '0'}, {".----", '1'}, {"..---", '2'}, {"...--", '3'}, {"....-", '4'}, {".....", '5'}, {"-....", '6'}, {"--...", '7'}, {"---..", '8'}, {"----.", '9'} }; string input; getline(cin, input); istringstream iss(input); string morseCode; string result; while (iss >> morseCode) { if (morseToDigit.find(morseCode) != morseToDigit.end()) { result += morseToDigit[morseCode]; } } cout << result << endl; return 0; }

TOO EZ QUESTION YOU USE AI LOL


How to you know huh?

 
ZeroJudge Forum