题解 | #阶乘#
阶乘
https://www.nowcoder.com/practice/e58c8a55162d49c48115bdfa5da7da56
#include <bits/stdc++.h> using namespace std ; int jie(int n) { if(n == 1) return 1 ; else return n * jie(n - 1); } int main() { int n ; while(cin >> n) { int y1 = 0 , y2 = 0 ; for(int i = 1 ; i <= n ; i ++ ) { if(i % 2 == 1) y1 += jie(i) ; else y2 += jie(i) ; } cout << y1 << " " << y2 << endl; } return 0 ; }