求调
查看原帖
求调
1769771
GEYIHAO楼主2025/7/25 14:49
#include <bits/stdc++.h>
using namespace std;
stack<char> st;
int main(){
	unsigned long long n,s;
	cin>>n>>s;
	while(n--){
		char x;
		cin>>x;
		if(x=='U'){
			if(st.size()){
				st.pop();
			}else{
				if(s>1){
					s/=2;
				}
			}
		}else{
			st.push(x);
		}
	}
	while(!st.empty()){
		if(st.top()=='L'){
			s*=2;
		}else{
			s*=2;
			s++;
		}
		st.pop();
	} 
	cout<<s;
	return 0;
}

我这代码已经尽可能优化了,但是如果真的爆了unsigned long long咋办啊

不可能高精吧

2025/7/25 14:49
加载中...