map优化
2025-09-14 22:16:54
发布于:上海
1阅读
0回复
0点赞
#include<iostream>
#include<map>
#include<vector>
using namespace std;
map<char,int> mp;
vector<int> a;
long long ans;
int main(){
mp['R'] = 0,mp['D'] = 1,mp['L'] = 2,mp['U'] = 3;
int n;
cin >> n;
string s;
cin >> s;
for(auto it : s){
ans = mp[it] + (ans * 4);
}
cout << ans;
return 0;
}
十分easy
这里空空如也
有帮助,赞一个