0分求调
查看原帖
0分求调
781159
Lovely_Elaina楼主2023/1/28 23:29
#include <bits/stdc++.h>
using namespace std;

int T,n,x,z; string s;
unordered_map<string,int > hash_table;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    cin >> T;
    while(T--){
        cin >> x;
        if(x == 1){
            cin >> s >> z;
            hash_table[s] = z;
            cout << "OK" << endl;
        }else if(x == 2 || x == 3){
            cin >> s;
            if(hash_table.count(s) == 1){
                if(x == 2) cout << hash_table[s] << endl;
                else{
                    hash_table.erase(hash_table.find(s));
                    cout << "Deleted successfully" << endl;
                }
            }else cout << "Not found" << endl;
        }else{
            cout << n << endl;
        }
    }
    
    return 0;
}
2023/1/28 23:29
加载中...