結果

問題 No.398 ハーフパイプ(2)
ユーザー beet
提出日時 2018-12-04 12:59:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 1,523 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 205,968 KB
最終ジャッジ日時 2025-01-06 18:08:22
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  double x;
  cin>>x;
  Int y=round(x*4);

  Int ans=0;
  vector<Int> f(10,1);
  for(Int i=1;i<10;i++) f[i]=f[i-1]*i;
  for(Int a=0;a<=100;a++){
    for(Int b=a;b<=100;b++){
      for(Int c=b;c<=100;c++){
        Int d=y-(a+b+c);
        if(d<c||d<0||d>100) continue;
        {
          Int p=a,q=d;
          vector<Int> v({p,a,b,c,d,q});
          map<Int, Int> m;
          for(Int x:v) m[x]++;
          Int res=f[6];
          for(auto w:m) res/=f[w.second];
          ans+=res;
        }
        {
          Int p=a,q=d+1;
          vector<Int> v({p,a,b,c,d,q});
          map<Int, Int> m;
          for(Int x:v) m[x]++;
          Int res=f[6];
          for(auto w:m) res/=f[w.second];
          ans+=res*(100-d);
        }
        {
          Int p=a-1,q=d;
          vector<Int> v({p,a,b,c,d,q});
          map<Int, Int> m;
          for(Int x:v) m[x]++;
          Int res=f[6];
          for(auto w:m) res/=f[w.second];
          ans+=res*a;
        }
        {
          Int p=a-1,q=d+1;
          vector<Int> v({p,a,b,c,d,q});
          map<Int, Int> m;
          for(Int x:v) m[x]++;
          Int res=f[6];
          for(auto w:m) res/=f[w.second];
          ans+=res*a*(100-d);
        }        
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}
0