結果

問題 No.398 ハーフパイプ(2)
ユーザー rickythetarickytheta
提出日時 2016-07-17 13:47:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 1,845 bytes
コンパイル時間 1,669 ms
コンパイル使用メモリ 152,712 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 22:12:48
合計ジャッジ時間 2,890 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 47 ms
4,380 KB
testcase_03 AC 47 ms
4,380 KB
testcase_04 AC 46 ms
4,380 KB
testcase_05 AC 7 ms
4,380 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 24 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 13 ms
4,376 KB
testcase_10 AC 10 ms
4,376 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 26 ms
4,380 KB
testcase_13 AC 25 ms
4,380 KB
testcase_14 AC 30 ms
4,376 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 25 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// シャロちゃん!!!!!シャロちゃん!!!!!!!!!!!!!!!!!!!

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

ll calc(int a,int b,int c,int d,int e,int f){
  static ll fact[] = {1,1,2,6,24,120,720};
  vi arr;
  arr.push_back(a);
  arr.push_back(b);
  arr.push_back(c);
  arr.push_back(d);
  arr.push_back(e);
  arr.push_back(f);
  map<int,int> cnt;
  REP(i,6)cnt[arr[i]]++;
  ll ret = fact[6];
  for(auto it:cnt){
    ret /= fact[it.second];
  }
  return ret;
}

void solve(int s){
  ll ans = 0;
  FOR(a,0,101)FOR(b,a,101)FOR(c,b,101){
    int d = s-(a+b+c);
    if(d<c)break;
    if(d>100)continue;
    // low is a && high is d
    ans += calc(a,a,b,c,d,d);
    // low less a && high is d
    ans += calc(-1,a,b,c,d,d) * a;
    // low is a && high more d
    ans += calc(a,a,b,c,d,101) * (100-d);
    // low less a && high more d
    ans += calc(-1,a,b,c,d,101) * a * (100-d);
  }
  printf("%lld\n",ans);
}

int main(){
  int u,d;
  scanf("%d.%d",&u,&d);
  int s = u*4 + (d/25);
  solve(s);
  return 0;
}
0