P1322 #2 WA 90pts 求调(玄关)
查看原帖
P1322 #2 WA 90pts 求调(玄关)
737097
封禁用户楼主2024/8/29 10:58

RT

#include<bits/stdc++.h>
using namespace std;
long long sta[100005];
int top=0;
long long stb[100005];
int main(){
	string a;
	while(cin>>a){
		if(a=="REPEAT"){
			int b;cin>>b;
			sta[++top]=b;
			char t;cin>>t;
		}
		if(a=="FD"){
			int b;cin>>b;
			stb[top]+=b;
		}
		if(a=="BK"){
			int b;cin>>b;
			stb[top]-=b;
		}
		if(a[0]==']'){
			for(int i=0;i<a.length();i++){
				stb[top-1]+=stb[top]*sta[top];
				top--;
			} 
		} 
	}
	cout<<abs(stb[0]);
	return 0;
}
2024/8/29 10:58
加载中...