No output?!
查看原帖
No output?!
1359554
guhaoyu_1楼主2025/7/23 19:12
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    int n;
    cin>>n;
    
    map<string,string> dictionary;
    
    string a,b;
    for(int i=1;i<=n;i++){
        cin>>a>>b;
        dictionary[a]=b;
    }
    
    
    string article;
    getline(cin, article);
    
    string word;
    for(char c : article) {
        if(islower(c)) {
            word += c;
        } else {
            if(!word.empty()) {
                if(dictionary.find(word) != dictionary.end()) {
                    cout << dictionary[word];
                } else {
                    cout << "UNK";
                }
                word = "";
            }
            cout << c;
        }
    }
    
    if(!word.empty()) {
        if(dictionary.find(word) != dictionary.end()) {
            cout << dictionary[word];
        } else {
            cout << "UNK";
        }
    }
    
    return 0;
}

所有全WA了,拿了0{\color{red} 0 {}}分的好成绩,求调

2025/7/23 19:12
加载中...