社区讨论

80的邪修(只增笑尔罢了)

P1383高级打字机参与者 3已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@mityk87z
此快照首次捕获于
2025/12/06 15:14
3 个月前
此快照最后确认于
2025/12/08 16:50
3 个月前
查看原帖
CPP
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0)

const int maxx=1e5+4;
int n,t;
string s[maxx];

int main(){
	IOS;
	cin>>n;
	while (n--){
		char opt;
		cin>>opt;
		if (opt=='T'){
			char x;
			int tmp=t;
			cin>>x;
			s[++t]=s[tmp];
			s[t]+=x;
		}
		else if (opt=='U'){
			int x,tmp=t;
			cin>>x;
			s[++t]=s[tmp-x];
		}
		else{
			int x;
			cin>>x;
			cout<<s[t][x-1]<<"\n"; 
		}
	}
	return 0;
}

回复

3 条回复,欢迎继续交流。

正在加载回复...