QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#472944 | #6699. Wandering Robot | YangHyyy | WA | 0ms | 3596kb | C++23 | 600b | 2024-07-11 20:30:42 | 2024-07-11 20:30:42 |
Judging History
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'