求条!酒铭
查看原帖
求条!酒铭
1517836
wqy0525楼主2025/7/30 12:10
#include<bits/stdc++.h>
using namespace std;
const long long N=1e6+17;
long long n,t;
map<string,long long> a;
string s;
long long x,op,cnt;
inline void out(long long x){
	if(x/10!=0) out(x/10);
	putchar(x%10+'0');
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    t=n;
    while(t--){
    	cin>>op;
    	if(op==1){
    		cin>>s>>x;
    		a[s]=x;
    		cnt++;
    		cout<<"OK"<<'\n';
		}
		else if(op==2){
			cin>>s; 
			if(!a[s]){
				cout<<"Not found"<<'\n';
				continue;
			}
			cout<<a[s]<<'\n';
		}
		else if(op==3){
			cin>>s;
			if(!a[s]){
				cout<<"Not found"<<'\n';
			}
			else{
				cnt--;
				a[s]=0;
				cout<<"Deleted successfully"<<'\n';
			}
		}
		else{
			cout<<cnt<<'\n';
		}
	}
	return 0;
}

样例过了,全WA

2025/7/30 12:10
加载中...