救救救救救救救救救救救救救救救救救命,为什么样例过不了!!!
查看原帖
救救救救救救救救救救救救救救救救救命,为什么样例过不了!!!
1053216
Fallenrain楼主2023/8/18 15:05
#include<bits/stdc++.h>
using namespace std;

struct jewel{
	string n;
	bool c=false;
	int p;
};

int main(){
	int n,k,p=0;
	jewel b[1001]={};
	string s;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>b[i].n>>b[i].p;
	}
	for(int i=0;i<k;i++){
		cin>>s;
		for(int j=0;j<n;j++){
			if(b[i].n==s){
				(b[i].c)?(p+=b[i].p):	(b[i].c=true);
			}
		}
	}
	cout<<p;
	return 0;
}

为什么我用结构体过不了!!!

2023/8/18 15:05
加载中...