結果

問題 No.3584 Camouflage Mole
コンテスト
ユーザー askr58
提出日時 2026-07-10 21:23:13
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,251 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,050 ms
コンパイル使用メモリ 337,220 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-10 21:23:19
合計ジャッジ時間 3,729 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/modint>
using mint=atcoder::modint998244353;
using namespace std;
using ll=long long;
struct Combination{
	int n;
	vector<mint> _fact,_factinv;

	Combination(int n):n(n){
		_fact.resize(n+1,1);_factinv.resize(n+1,1);
		for(int i=0;i<n;i++)_fact[i+1]=_fact[i]*(i+1);
		_factinv[n]=_fact[n].inv();
		for(int i=n-1;i>=0;i--)_factinv[i]=_factinv[i+1]*(i+1);
	}
	mint fact(int x){
		return _fact[x];
	}
	mint factinv(int x){	
		return _factinv[x];
	}
	mint C(int x,int y){
		assert(0<=x&&x<=n&&0<=y);
		if(x<y)return 0;
		else return _fact[x]*_factinv[y]*_factinv[x-y];
	};
	mint Cinv(int x,int y){
		assert(0<=x&&x<=n&&0<=y);
		if(x<y)return 0;
		else return _factinv[x]*_fact[y]*_fact[x-y];
	}
	mint P(int x,int y){
		assert(0<=x&&x<=n&&0<=y);
		if(x<y)return 0;
		else return _fact[x]*_factinv[x-y];
	}
	mint Pinv(int x,int y){
		assert(0<=x&&x<=n&&0<=y);
		if(x<y)return 0;
		else return _factinv[x]*_fact[x-y];
	}
	mint frac(int y,int x){
		assert(x!=0);
		if(y==0)return 0;
		else return (_fact[y]*_factinv[y-1]*_factinv[x]*_fact[x-1]);
	}
};
		
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	Combination comb(n+10);
	cout<<((comb.C(n,4)*((mint)26).pow(n-4))).val()<<endl;
}
0