P1322 #2WA求助,玄关
  • 板块灌水区
  • 楼主yu123456
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/8/29 09:39
  • 上次更新2024/8/29 12:32:53
查看原帖
P1322 #2WA求助,玄关
101681
yu123456楼主2024/8/29 09:39
#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 09:39
加载中...