QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#472944#6699. Wandering RobotYangHyyyWA 0ms3596kbC++23600b2024-07-11 20:30:422024-07-11 20:30:42

Judging History

你现在查看的是最新测评结果

  • [2024-07-11 20:30:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-07-11 20:30:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int p=1e9+7;
void solve()
{
	int n,k;
	int ans=0;
	cin>>n>>k;
	string s;
	cin>>s;
	map<char,int> mp;
	for(int i=0;i<s.size();i++)
	{
		mp[s[i]]++;
	}
	if((mp['L']==0&&mp['D']==0)||(mp['R']==0&&mp['U']==0))
	{
		ans=k;
		cout<<ans<<endl;
		return; 
	}
	int jia=mp['U']+mp['R'],jian=mp['L']+mp['D'];
	int dy=max(jia,jian);
	if(k==1)
	{
		cout<<dy<<endl;
		return ;
	}
	ans=(abs(jia-jian))*k;
	cout<<ans<<endl;
	return ;
}
signed main()
{
	int t;
	cin>>t;
	while(t--)
	solve();
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3596kb

input:

2
3 3
RUL
1 1000000000
D

output:

3
1000000000

result:

wrong answer 1st numbers differ - expected: '4', found: '3'