样例过了,但是全WA,求大佬调代码
查看原帖
样例过了,但是全WA,求大佬调代码
747212
datong4321楼主2023/3/14 20:40
#include<bits/stdc++.h>
using namespace std;
map<string,int> m;
int n;
int k,j;
int ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>k;
		string temp1;
		int score;
		if(k==1){
			cin>>temp1>>score;
			if(!m[temp1]){
				cout<<"OK"<<endl;
				ans++;
			}
			m[temp1]=score;
		}
		else if(k==2){
			cin>>temp1;
			if(!m[temp1]){
				cout<<"Not found"<<endl;
			}
			else cout<<m[temp1]<<endl;
		}
		else if(k==3){
			cin>>temp1;
			if(!m[temp1]){
				cout<<"Not found";
			}
			else {
				m[temp1]=0;
				ans--;
				cout<<"Deleted successfully"<<endl;
			}
		}
		else cout<<ans<<endl;
	}
	return 0;
} 
2023/3/14 20:40
加载中...