#include <iostream> #include <cstring> #include <algorithm> #include <string> using namespace std; struct bign{ int d[3000]; int len; bign(){ memset(d, 0, sizeof(d)); len = 0; } }; //输入大整数,以字符串读入,然后再把字符串另存为至bign结构体 bign change(string s){ bign a; a.len = s.length(); for(int i = 0; i < a.len; i++){ a.d[i] = s[a.len - i - 1] - '0'; } return a; } //高精度加法 bign add(bign a, bign b){ bign c; int carry = 0; for(int i = 0; i < a.len || i < b.len; i++){ int tmp = a.d[i] + b.d[i] + carry; carry = tmp / 10; c.d[c.len++] = tmp % 10; } if(carry != 0){ c.d[c.len++] = carry; } return c; } //高精度阶乘 bign fac(int n){ bign c; c.d[0] = 1; int j; int carry = 0; int point = 1; for(int i = 2; i <= n; i++){ for(j = 0; j < point; j++){ int tmp = i * c.d[j] + carry; carry = tmp / 10; c.d[j] = tmp % 10; } while(carry != 0){ c.d[j] = carry % 10; carry /= 10; j++; } point = j; } c.len = point; return c; } void print(bign a){ for(int i = a.len - 1; i >= 0; i--){ printf("%d", a.d[i]); } } int main(){ int n; bign y1, y2; y1.len = 1, y2.len = 1; scanf("%d", &n); for(int i = 1; i <= n; i++){ //为奇数 if(i & 1){ y1 = add(y1, fac(i)); }else{ y2 = add(y2, fac(i)); } } print(y1); printf(" "); print(y2); printf("\n"); return 0; }