2020 뉴커머스 여름방학 다교훈련캠프(제1차)
11766 단어 소몰이꾼
J.Easy Integration(수학) 문제 전송에는 다음과 같은 지식이 필요합니다.
분수 모형은 분자*분모의 역원%mod이고, 분모의 역원은 분모입니다^(mod-2)%mod 공식 유도 결과는 다음과 같습니다. (n!)^2/(2 * n + 1)! AC 코드
#include
inline long long read(){char c = getchar();long long x = 0,s = 1;
while(c < '0' || c > '9') {if(c == '-') s = -1;c = getchar();}
while(c >= '0' && c <= '9') {x = x*10 + c -'0';c = getchar();}
return x*s;}
using namespace std;
#define NewNode (TreeNode *)malloc(sizeof(TreeNode))
#define Mem(a,b) memset(a,b,sizeof(a))
#define lowbit(x) (x)&(-x)
const int N = 2e6 + 5;
const long long INFINF = 0x7f7f7f7f7f7f7f;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-7;
const int mod = 998244353;
const double II = acos(-1);
const double PP = (II*1.0)/(180.00);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> piil;
ll dp[N];
ll quick_pow(ll a,ll b)
{
ll ans = 1;
while(b)
{
if(b&1)
ans = ans*a%mod;
b>>=1;
a = a*a%mod;
}
return ans;
}
signed main()
{
std::ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
dp[0] = dp[1] = 1;
for(int i = 2;i <= N;i++)
dp[i] = dp[i-1]*i%mod;
ll n;
while(cin >> n)
cout << (dp[n]*dp[n]%mod)*quick_pow(dp[2*n+1],mod-2)%mod << endl;
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
뉴커스 연습 경기 67-A, 뉴커스 사랑 문자열제목 링크 문자열을 지정하여 숫자를 추출하고 공백으로 구분하여 출력합니다. 문자열 길이는 0≤l e n≤10000\le len\le 10000 ≤ len ≤1000입니다. 문자열을 한 번 훑어보고 연속 숫자를 만나서...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.