結果

問題 No.8045 怪文書
ユーザー claw88
提出日時 2019-04-01 22:33:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 841 bytes
コンパイル時間 1,510 ms
コンパイル使用メモリ 165,780 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 03:29:08
合計ジャッジ時間 2,283 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define dom 998244353
#define all(c) begin(c),end(c)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
#define long long long
#define List vector
#define var auto
#define Count size()
#define Length size()
int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑

void solve()
{
	long N, M;
	cin >> N >> M;
	if (M <= N)
	{
		cout << 0 << endl;
		return;
	}
	long ans = 1;
	for (int i = 1; i <= N; i++)
	{
		ans = ans * i % M;
	}
	cout << ans << endl;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}
0