QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#264470#7683. Hard Brackets ProblemsilkcodeCompile Error//C++23286b2023-11-25 14:08:162023-11-25 14:08:16

Judging History

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

  • [2023-11-25 14:08:16]
  • 评测
  • [2023-11-25 14:08:16]
  • 提交

answer

#include<cstdio>
int T;
constexpr int MN=1e6+7;
char s[MN];
int main() {
  scanf("%d",&T);
  for (;T;--T) {
    scanf("%s",s);
    cnt=0;
    for (char *c=s;*c;++c)
      if (*c=='(')
        ++cnt;
      else
        if (cnt)--cnt;
    puts(cnt?"impossible":s);
  }
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:9:5: error: ‘cnt’ was not declared in this scope; did you mean ‘int’?
    9 |     cnt=0;
      |     ^~~
      |     int
answer.code:6:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |   scanf("%d",&T);
      |   ~~~~~^~~~~~~~~
answer.code:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%s",s);
      |     ~~~~~^~~~~~~~