結果

問題 No.73 helloworld
ユーザー otsnskotsnsk
提出日時 2014-12-27 18:32:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,153 bytes
コンパイル時間 1,226 ms
コンパイル使用メモリ 60,416 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 07:34:29
合計ジャッジ時間 2,068 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <set>

#define FORR(i,b,e) for(int i=(b);i<(int)(e);++i)
#define FOR(i,e) FORR(i,0,e)
#define dump(var) cerr << #var ": " << var << "\n"
#define dumpc(con) for(auto& e: con) cerr << e << " "; cerr<<"\n"

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

ull pt[105][105];

void calc_pascal() {
    pt[0][0] = 1;
    FORR(i, 1, 101) {
        pt[i][0] = 1;
        FORR(j, 1, i+2) {
            pt[i][j] = pt[i-1][j-1] + pt[i-1][j];
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    calc_pascal();

    set<int> g1 = {7, 4, 22, 17, 3}, g2 = {11, 14};
    int C;
    ull n = 1;
    FOR(i, 26) {
        cin >> C;
        if (g1.find(i) != g1.end()) {
            n *= C;
        }
        else if (i == 14) { // 'o'
            n *= C/2 * (C-C/2);
        }
        else if (i == 11) { // 'l'
            if (C < 3) n *= 0;
            else {
                ull m = 0;
                FORR(k, 2, C) {
                    m = max(m, pt[k][2] * (C-k));
                }
                n *= m;
            }
        }
    }
    cout << n << endl;

    return 0;
}
0