結果
| 問題 |
No.1904 Never giving up!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-15 21:26:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 412 bytes |
| コンパイル時間 | 614 ms |
| コンパイル使用メモリ | 63,744 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 23:25:46 |
| 合計ジャッジ時間 | 1,081 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
int n;
cin >> n;
ll fact[22];
fact[0] = 1;
for(int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i;
int b[22]{0};
for(int i = 0; i < n; i++){
int a;
cin >> a;
a--;
b[a]++;
}
ll ans = fact[n];
for(int i = 0; i < n; i++) ans /= fact[b[i]];
cout << ans << endl;
}