結果

問題 No.118 門松列(2)
ユーザー itezpace
提出日時 2016-07-30 07:09:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 70,168 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-06 20:17:10
合計ジャッジ時間 2,157 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
  int n,a;
  cin>>n;
  map<int,int> m;
  map<int,int>::iterator it;
  for(int i=0; i<n; ++i){
    cin>>a;
    it=m.find(a);
    if(it!=m.end()){
      m[a]++;
    }else{
      m.insert(make_pair(a,1));
    }
  }
  ll x;
  x=1;
  for(int i=m.size(); i>m.size()-3; --i){
    x*=i;
  }
  x/=6;
  for(it=m.begin(); it!=m.end(); ++it){
    if(it->second>1){
      x*=it->second;
    }
  }
  x%=mod;
  cout<<x<<endl;
  return 0;
}
0