QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#567209#9308. World CupLinkZeldaCompile Error//C++14907b2024-09-16 10:04:002024-09-16 10:04:00

Judging History

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

  • [2024-09-16 10:04:00]
  • 评测
  • [2024-09-16 10:04:00]
  • 提交

answer

#include<bits/stdc++.h>
#define pr pair<int,int>
#define eps 1e-10
#define pi 3.141592653589793

using namespace std;

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int a[40],p[40];

void solve()
{
	for(int i=1;i<=n;i++)
		a[i]=read(),p[i]=i;
	sort(p+1,p+32+1,[&](int x,int y){return a[x]<a[y];});
	for(int i=1;i<=32;i++)
	{
		if(p[i]==1)
		{
			if(i==32)
				return puts("1"),void();
			if(i>=28)
				return puts("2"),void();
			if(i>=14)
				return puts("4"),void();
			if(i>=7)
				return puts("8"),void();
			if(i>=3)
				return puts("16"),void();
			return puts("32"),void();
		}
	}
}

signed main()
{
//	freopen("prime.in","r",stdin);
//	freopen("prime.out","w",stdout);
	int Tests=read();
	while(Tests--)
		solve();
	return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:20:24: error: ‘n’ was not declared in this scope
   20 |         for(int i=1;i<=n;i++)
      |                        ^