QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#275600#7894. Many Many HeadszyyscjCompile Error//C++14725b2023-12-04 21:19:162023-12-04 21:19:16

Judging History

你现在查看的是最新测评结果

  • [2023-12-04 21:19:16]
  • 评测
  • [2023-12-04 21:19:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
stack<PII>st;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		string s;
		cin >> s;
		int num0 = 0;
		int num1 = 0;
		bool ok1 = 0;
		bool ok2 = 0;
		for(int j = 0; j < s.size(); j++)
		{
			if(s[j] == '[' || s[j] == ']')
			{
				num1++;
			}
			else
			{
				if(num1 % 2 == 0) num0++;
			}
		}
		if(num0 >= 3)
		{
			ok0 = 1;
		}
	    num0 = 0;
		num1 = 0;
		for(int j = 0; j < s.size(); j++)
		{
			if(s[j] == '(' || s[j] == ')')
			{
				num0++;
			}
			else
			{
				if(num0 % 2 == 0) num1++;
			}
		}
		if(num1 >= 3)
		{
			ok1 = 1;
		}
		if(ok0 && ok1)cout<<"No\n";
		else cout << "Yes\n";
	}
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:30:25: error: ‘ok0’ was not declared in this scope; did you mean ‘ok2’?
   30 |                         ok0 = 1;
      |                         ^~~
      |                         ok2
answer.code:49:20: error: ‘ok0’ was not declared in this scope; did you mean ‘ok2’?
   49 |                 if(ok0 && ok1)cout<<"No\n";
      |                    ^~~
      |                    ok2