結果

問題 No.1694 ZerOne
ユーザー ぷらぷら
提出日時 2021-10-01 21:48:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 199,164 KB
実行使用メモリ 55,136 KB
最終ジャッジ日時 2023-09-26 16:58:29
合計ジャッジ時間 3,770 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,760 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
7,576 KB
testcase_03 WA -
testcase_04 AC 4 ms
11,660 KB
testcase_05 AC 9 ms
28,600 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 6 ms
24,236 KB
testcase_08 AC 9 ms
32,508 KB
testcase_09 WA -
testcase_10 AC 7 ms
26,272 KB
testcase_11 AC 2 ms
5,464 KB
testcase_12 AC 3 ms
7,516 KB
testcase_13 AC 10 ms
34,808 KB
testcase_14 WA -
testcase_15 AC 8 ms
30,468 KB
testcase_16 AC 7 ms
26,264 KB
testcase_17 AC 4 ms
13,788 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 28 ms
54,948 KB
testcase_21 AC 28 ms
54,844 KB
testcase_22 AC 26 ms
54,008 KB
testcase_23 AC 27 ms
55,136 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 25 ms
53,712 KB
testcase_27 AC 24 ms
53,652 KB
testcase_28 AC 16 ms
45,304 KB
testcase_29 AC 17 ms
45,324 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int dp[61][61][3601];

int main() {
    string S;
    cin >> S;
    int sum1 = 0,sum2 = 0;
    for(int i = 0; i < S.size(); i++) {
        sum1 += S[i]-'0';
    }
    for(int i = 0; i < S.size(); i++) {
        for(int j = i; j < S.size(); j++) {
            if(S[i] > S[j]) {
                sum2++;
            }
        }
    }
    dp[0][0][0] = 1;
    for(int i = 0; i < S.size(); i++) {
        for(int j = 0; j < S.size(); j++) {
            for(int k = 0; k < S.size()*S.size(); k++) {
                dp[i+1][j+1][k] += dp[i][j][k];
                dp[i+1][j][k+j] += dp[i][j][k];
            }
        }
    }
    cout << dp[S.size()][sum1][sum2] << endl;
}
0