QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#472182#4928. Game With Numbers0005Compile Error//C++20664b2024-07-11 14:55:012024-07-11 14:55:05

Judging History

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

  • [2024-07-11 14:55:05]
  • 评测
  • [2024-07-11 14:55:01]
  • 提交

answer

#include<iostream>
#include<vector> 
using namespace std;
long long n,m,s,x,b[20005];
vector<long long> v;
long long solve(long long dep)
{
	if(dep>m){
		long long tot=0;
		for(auto x:v) tot+=x;
		return tot;
	}
	if(!v.size()) return 0;
	vector<long long> p,q;
	for(auto x:v){
		if(x%b[dep]) p.push_back(x);
		else q.push_back(x);
	}
	if(dep%2) return min(solve(dep+1,p),solve(dep+1,q))
 } 	else return max(solve(dep+1,p),solve(dep+1,q));
int main(){
	cin>>n>>m;
	if(m>100) {cout<<"0\n"; return 0;}
	for(long long i=1;i<=n;i++) {cin>>x; v.push_back(x); s+=x;}
	for(long long i=1;i<=m;i++) cin>>b[i];
	cout<<solve(1)<<"\n";
	return 0;
 } 

详细

answer.code: In function ‘long long int solve(long long int)’:
answer.code:19:35: error: too many arguments to function ‘long long int solve(long long int)’
   19 |         if(dep%2) return min(solve(dep+1,p),solve(dep+1,q))
      |                              ~~~~~^~~~~~~~~
answer.code:6:11: note: declared here
    6 | long long solve(long long dep)
      |           ^~~~~
answer.code:19:50: error: too many arguments to function ‘long long int solve(long long int)’
   19 |         if(dep%2) return min(solve(dep+1,p),solve(dep+1,q))
      |                                             ~~~~~^~~~~~~~~
answer.code:6:11: note: declared here
    6 | long long solve(long long dep)
      |           ^~~~~
answer.code:19:60: error: expected ‘;’ before ‘}’ token
   19 |         if(dep%2) return min(solve(dep+1,p),solve(dep+1,q))
      |                                                            ^
      |                                                            ;
   20 |  }      else return max(solve(dep+1,p),solve(dep+1,q));
      |  ~                                                          
answer.code: At global scope:
answer.code:20:9: error: expected unqualified-id before ‘else’
   20 |  }      else return max(solve(dep+1,p),solve(dep+1,q));
      |         ^~~~
answer.code: In function ‘long long int solve(long long int)’:
answer.code:20:2: warning: control reaches end of non-void function [-Wreturn-type]
   20 |  }      else return max(solve(dep+1,p),solve(dep+1,q));
      |  ^