結果

問題 No.398 ハーフパイプ(2)
ユーザー face4face4
提出日時 2019-03-21 18:11:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,173 bytes
コンパイル時間 819 ms
コンパイル使用メモリ 79,020 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 05:28:36
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,348 KB
testcase_01 AC 12 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 12 ms
4,348 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;
typedef long long ll;

int main(){
    double x;
    cin >> x;
    ll ans = 0, base[7];
    base[0] = 1;
    for(int i = 1; i < 7; i++)  base[i] = base[i-1]*i;
    for(int i = 0; i <= 100; i++){
        for(int j = i; j <= 100; j++){
            for(int k = j; k <= 100; k++){
                for(int l = k; l <= 100; l++){
                    if((double)(i+j+k+l)/4!=x)  continue;
                    // printf("%d %d %d %d\n", i, j, k, l);
                    ll tempb = base[6];
                    map<int,int> app;
                    app[i]++, app[j]++, app[k]++, app[l]++;
                    for(auto p : app){
                        tempb /= base[p.second];
                    }
                    if(i == 0){
                        if(l == 100){
                            tempb /= (++app[i]);
                            tempb /= (++app[l]);
                            ans += tempb;
                        }else{
                            tempb /= (++app[i]);
                            ans += (100-l) * tempb;
                            tempb /= (++app[l]);
                            ans += tempb;
                        }
                    }else{
                        if(l == 100){
                            tempb /= (++app[l]);
                            ans += i * tempb;
                            tempb /= (++app[i]);
                            ans += tempb;
                        }else{
                            ans += (i + 100 - l) * tempb;
                            
                            tempb /= (++app[i]);
                            ans += (100-l) * tempb;
                            tempb *= (app[i]--);
                            
                            tempb /= (++app[l]);
                            ans += i * tempb;
                            tempb *= (app[l]--);

                            tempb /= (++app[i]);
                            tempb /= (++app[l]);

                            ans += tempb;
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0