求大佬帮忙看一下
  • 板块题目总版
  • 楼主wmhwuminhao
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/2/23 17:08
  • 上次更新2024/2/23 19:57:46
查看原帖
求大佬帮忙看一下
1191207
wmhwuminhao楼主2024/2/23 17:08
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string s1 , s2 ;
int x , cc ;
int main(){
	cin >> s1 ;
	while ( s1[cc] != '\0' ){
		if ( s1[cc] == '(' ) {
			cout << s1[cc] ;
			s2[cc] = s1[cc] ;
			x++ ; 
		}
		if ( s1[cc] == ')' ) {
			if ( x != 0 ) {
				cout << s1[cc] ;
				x-- ;
			} else cout << "(" << s1[cc] ;
		} 
		cc++ ;
	}
	while ( x != 0 ) {
		cout << ")" ;
		x-- ;
	}
	return 0;
}

这道题60分4个RE,哪里有问题?希望各位大神多多指点

2024/2/23 17:08
加载中...