死活找不出错的一个玄学输出
  • 板块灌水区
  • 楼主MsgNotFound
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/4/17 20:31
  • 上次更新2024/4/17 20:33:00
查看原帖
死活找不出错的一个玄学输出
906900
MsgNotFound楼主2024/4/17 20:31
#include<bits/stdc++.h>
using namespace std;
const int maxl=110;
char s[maxl];
stack<int>st;
int main(){
	cin>>s;
	for(int i=0;i<strlen(s);i++){
		if(s[i]=='(')st.push(s[i]);
		else {
			cout<<st.top()<<' '<<i<<endl;
			st.pop(); 
		}
	}
}

rt,找不出错,输出总是多东西

2024/4/17 20:31
加载中...