Why did I WA?
查看原帖
Why did I WA?
513807
O3O_O3O_O3O楼主2021/12/25 18:07

Please look at here.

#include<bits/stdc++.h>
using namespace std;
struct N{
	string name;
	long long score;
}; 
int main(){
	N a[100001]={};
	string c;
	int b,n,count=0,asuodg;
	long long d;
	bool o=0;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> b;
		if(b==1){
			cin >> c >> d;
			if(count==0){
				a[++count].name = c;
				a[count].score = d;
			}
			else{
				for(int j=1;j<=count;j++){
					if(a[j].name == c){
						o = 1;
						asuodg = i;
					}
				}
				if(o){
					o=0;
					a[asuodg].score = d;
				}
				else{
					a[++count].name = c;
					a[count].score = d;
				}
			}
			cout << "OK" << endl;
		}
		else if(b==2){
			cin >> c;
			for(int j=1;j<=count;j++){
				if(a[j].name == c){
					o = 1;
					cout << a[j].score << endl;
				}
			}
			if(o){
				o=0;
			}
			else{
				cout << "Not found" << endl;
			}
		}
		else if(b==3){
			cin >> c;
			for(int j=1;j<=count;j++){
				if(a[j].name == c){
					a[j].name = "O3O_O3O_O3O";
					cout << "Deleted successfully" << endl;
					o = 1;
				}
			}
			if(o){
				count--;
				o = 0;
			}
			else{
				cout << "Not found" << endl;
			}
		}
		else{
			cout << count << endl;//中国人不骗中国人
		}
	}
    return 0;
}
2021/12/25 18:07
加载中...