QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432839#6712. Sum of Factorialssurenjamts#WA 3ms3556kbC++14689b2024-06-07 18:39:452024-06-07 18:39:45

Judging History

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

  • [2024-06-07 18:39:45]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3556kb
  • [2024-06-07 18:39:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N = 1e6 + 5;
bool ans[N+5];
void solve() {
		int n;
	cin >> n;
	if(n == -1) return;
	if(ans[n]) cout << "Yes\n";
	else cout << "No\n";
	solve();

	
}
signed main(){
	long long 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++){
		  vector<int> temp;
		  for(int i = 0; i<=N; i++){
		  	   if(ans[i]) {
		  	   	     if(i + fact[k] > N) continue;
		  	   	     temp.push_back(i + fact[k]);
		  	   }
		  }
		  for(auto it : temp) ans[it] = true;
	}

	
	
	
solve();
	
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 3556kb

input:

9
-1

output:

Yes

result:

wrong answer 1st lines differ - expected: 'YES', found: 'Yes'