QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#394217#4913. 子集匹配hswfwkjCompile Error//C++14269b2024-04-20 10:22:282024-04-20 10:22:28

Judging History

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

  • [2024-04-20 10:22:28]
  • 评测
  • [2024-04-20 10:22:28]
  • 提交

answer

#include<bits/stdc++.h>
#include "hall.h"
using namespace std;
int solve(int n, int K, int s)
{
	int mn = 0, pos = 0;
	for(int i = 1; i <= n; i++)
	{
		if(s & (1 << i - 1)) num++;
		else num--;
		if(num < mn) num = mn, pos = i;
	}
	return s ^ (1 << pos);
}

详细

implementer.cpp: In function ‘int main()’:
implementer.cpp:37:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   37 |         scanf("%d %d",&n,&K); assert(1<=n&&n<=27&&2*K>n);
      |         ~~~~~^~~~~~~~~~~~~~~
answer.code: In function ‘int solve(int, int, int)’:
answer.code:9:38: error: ‘num’ was not declared in this scope; did you mean ‘enum’?
    9 |                 if(s & (1 << i - 1)) num++;
      |                                      ^~~
      |                                      enum
answer.code:10:22: error: ‘num’ was not declared in this scope; did you mean ‘enum’?
   10 |                 else num--;
      |                      ^~~
      |                      enum
answer.code:11:20: error: ‘num’ was not declared in this scope; did you mean ‘enum’?
   11 |                 if(num < mn) num = mn, pos = i;
      |                    ^~~
      |                    enum