結果

問題 No.1904 Never giving up!
ユーザー publflpublfl
提出日時 2022-04-15 21:37:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 844 ms
コンパイル使用メモリ 67,240 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 07:38:43
合計ジャッジ時間 1,359 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
int a;
int x[110];
std::map<int,int> M,hash;
std::vector<int> index;

int main()
{
	
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	for(int i=1;i<=a;i++) index.push_back(x[i]);
	std::sort(index.begin(),index.end());
	index.erase(std::unique(index.begin(),index.end()),index.end());
	for(int i=0;i<index.size();i++) hash[index[i]] = i+1;
	for(int i=1;i<=a;i++) M[hash[x[i]]]++;
	
	long long int ans = 1;
	for(int i=1;i<=a;i++) ans*=i;
	for(std::map<int,int> ::iterator it = M.begin();it!=M.end();it++)
	{
		int t = (it->second);
		for(int i=1;i<=t;i++) ans/=i;
	}
	printf("%lld",ans);
}
0