2 条题解

  • 1
    @ 2023-8-26 10:54:04

    c++版

    #include <bits/stdc++.h>
    #define int long long
    #define p 998244353
    using namespace std;
    
    int fpow(int n, int m) {
    	int res = 1;
    	while (m) {
    		if (m & 1)
    			res = res * n % p;
    		n = n * n % p;
    		m >>= 1;
    	}
    	return res;
    }
    
    int inv(int n) {
    	return fpow(n, p - 2);
    }
    
    int ct(int n) {
    	if (n == 1)
    		return 1;
    	return ct(n - 1) * (4 * n - 2) % p * inv(n + 1) % p;
    }
    
    signed main() {
    	int n;
    	cin >> n;
    	cout << ct(n);
    	return 0;
    }
    
    • 0
      @ 2023-7-29 11:02:35

      python超简单版

      import sys
      sys.setrecursionlimit(100000);
      a=int(input());
      def h(n):
          if (n>1):
              return h(n-1)*(4*n-2)//(n+1);
          return 1;
      print(h(a)%998244353);
      
      • 1

      信息

      ID
      349
      时间
      1000ms
      内存
      256MiB
      难度
      7
      标签
      递交数
      22
      已通过
      7
      上传者