QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432848#6712. Sum of Factorialssurenjamts#Compile Error//C++14614b2024-06-07 18:55:352024-06-07 18:55:37

Judging History

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

  • [2024-06-07 18:55:37]
  • 评测
  • [2024-06-07 18:55:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std; 
const int N = 1e6 + 5;
bool ans[N+5];

int main(){
	int fact[20];
	fact[0] = 1;
	for (int i = 1; i<=11; i++){
	   fact[i] = fact[i-1] * i;	
		
	}                    

	ans[0] = true;
	ans[1] = true;
	for(int k = 1; k<=11; k++){
		  for(int i = N; i>=0; i--){
		  	   if(ans[i]) {
		  	   	     if(i + fact[k] > N) continue;
		  	   	    ans[i + fact[k]] = true;
		  	   }
		  }
	
	}

	int A = 0;
	while() {
		  cin >> A;
		  if( A == -1) break;
		  if(ans[A]) cout << "YES\n";
		  else cout << "NO\n";
		
		
		
	}
	
	
	
 
	
	
}

Details

answer.code: In function ‘int main()’:
answer.code:27:15: error: expected primary-expression before ‘)’ token
   27 |         while() {
      |               ^