Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
1637 | A班-许锘林 | 多项式求和 | C++ | 通过 | 100 | 0 MS | 264 KB | 380 | 2024-12-07 11:26:57 |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[11] = {0,1,2,6,24,120,720,5040,40320,362880,3628800}; int temp = a[1]; for(int i = 2;i <= n;i++) { if(i % 2 == 0) { temp -= a[i]; } else { temp += a[i]; } } cout<<temp; return 0; }