QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#571941#9308. World CuphardtigerCompile Error//C++14719b2024-09-18 10:31:132024-09-18 10:31:14

Judging History

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

  • [2024-09-18 10:31:14]
  • 评测
  • [2024-09-18 10:31:13]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int N = 40;
int a[N];

bool cmd(int x,int y){
	return x > y;
}

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t;
	cin >> t;
	int num[40];
	num[1] = 1;
	for(int i = 2;i <= 5; ++i){
		num[i] = 2;
	}
	for(int i = 6;i <= 19; ++i){
		num[i] = 4;
	}
	for(int i = 20;i <= 26; ++i){
		num[i] = 8;
	}
	for(int i = 27;i <= 30; ++i){
		num[i] = 16;
	}
	num[31] = num[32] = 32;
	while(t--){
		for(int i = 1;i <= 32; ++i){
			cin >> a[i];
		}
		int x = a[1];
		int ans = 0;
		sort(a + 1,a + 33,cmd);
		for(int i = 1;i <=32; ++i){
			if(x == a[i]){
				ans = nums[i];
				break;
			}
		}
		cout << ans << '\n';
	}
}

Details

answer.code: In function ‘int main()’:
answer.code:39:39: error: ‘nums’ was not declared in this scope; did you mean ‘num’?
   39 |                                 ans = nums[i];
      |                                       ^~~~
      |                                       num