QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432844#6712. Sum of Factorialssurenjamts#Compile Error//C++14676b2024-06-07 18:46:232024-06-07 18:46:24

Judging History

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

  • [2024-06-07 18:46:24]
  • 评测
  • [2024-06-07 18:46:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
	map<int , bool > mp;
void solve() {
	   int n;
	   cin >> n;
	   if(n == -1) continue;
		if(mp[n]) cout << "YES\n";
	else cout << "NO\n";
	solve();
	
	
}
signed main(){
		int n = 1e6 + 5;
	int fact[20];
	fact[0] = 1;
	for (int i = 1; i<=11; i++){
	   fact[i] = fact[i-1] * i;	
		
	}
	mp[0] = true;
	mp[1] = true;
	for(int i = 1; i<=11; i++){
		  vector<int> temp;
		  for(auto it : mp) {
		//  	cout << it.first << " " << fact[i] << endl;
		  	   if(it.first + fact[i] > n) continue;
		  	   temp.push_back(it.first + fact[i]);
		  }	
		  for(auto it : temp) mp[it] = true;
	}


solve();
	
	
}

Details

answer.code: In function ‘void solve()’:
answer.code:7:24: error: continue statement not within a loop
    7 |            if(n == -1) continue;
      |                        ^~~~~~~~