ACM 训练日志记录 · 思考 · 成长 提交 / 修改记录
王梓豪 / 题目列表训练档案
导出

J. Joker or Judger

来源:Codeforces 1200-1399

字符串匹配自评已掌握
本题活力0.26按难度、完成结果与训练证据估算

算法如山行则将至

题目描述

计算每个负面评论的分数总和,判断是否超过预期值。

代码

#include <bits/stdc++.h>
using namespace std;
int main()
{
	map<string,int> mp;
	mp["WrongProblem"]=100;
	mp["SameProblem"]=30;
	mp["UnreasonableProblemArrangement"]=10;
	mp["UnreasonableLimitForProblem"]=5;
	mp["WeakTestsForProblem"]=3;
	mp["BadProblem"]=1;
	int t;
	cin>>t;
	while(t--)
	{
		int n,p;
		cin>>n>>p;
		int total=0;
		for(int i=0;i<n;i++)
		{
			string temp;
			cin>>temp;
			if(mp.find(temp)!=mp.end()&&temp[temp.size()-1]=='t')total+=mp[temp];
			else {
				if(temp[temp.size()-1]<='L'&&temp[temp.size()-1]>='A')
				{
					temp.erase(temp.begin()+temp.size()-1);
					if(mp.find(temp)!=mp.end()&&temp!="UnreasonableProblemArrangement")total+=mp[temp];
				}
			}
			
		}
		if(total>p) cout<<"Joker"<<endl;
		else cout<<"Judger"<<endl;
	}
}