結果

問題 No.2593 Reorder and Mod 120
ユーザー LyricalMaestroLyricalMaestro
提出日時 2024-01-05 19:59:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,015 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 70,972 KB
最終ジャッジ日時 2024-01-05 19:59:04
合計ジャッジ時間 3,241 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
60,096 KB
testcase_01 WA -
testcase_02 AC 43 ms
60,136 KB
testcase_03 AC 42 ms
62,240 KB
testcase_04 AC 48 ms
62,240 KB
testcase_05 AC 40 ms
59,848 KB
testcase_06 AC 48 ms
62,364 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 48 ms
62,368 KB
testcase_12 AC 47 ms
64,448 KB
testcase_13 AC 52 ms
68,864 KB
testcase_14 AC 49 ms
66,504 KB
testcase_15 AC 50 ms
68,812 KB
testcase_16 AC 46 ms
64,456 KB
testcase_17 AC 48 ms
64,408 KB
testcase_18 AC 47 ms
64,424 KB
testcase_19 AC 51 ms
68,852 KB
testcase_20 AC 53 ms
70,972 KB
testcase_21 AC 53 ms
70,972 KB
testcase_22 AC 52 ms
70,972 KB
testcase_23 AC 55 ms
70,972 KB
testcase_24 AC 48 ms
68,624 KB
testcase_25 AC 49 ms
68,624 KB
testcase_26 AC 49 ms
68,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


def main():
    N = int(input())
    S = input()

    array = [0] * 10
    for s in S:
        array[int(s)] += 1

    r_set = set()
    for i1 in range(1, 10):
        for i2 in range(1, 10):
            for i3 in range(1, 10):
                b_array = [0] * 10
                b_array[i1] += 1
                b_array[i2] += 1
                b_array[i3] += 1
                is_ok = True
                for j in range(10):
                    if b_array[j] > array[j]:
                        is_ok = False
                        break

                if is_ok:
                    b = i1 * 100 + i2 * 10 + i3
                    b %= 120

                    for j in range(1, 10):
                        c = array[j] - b_array[j]
                        d = (40 * j) % 120
                        d *= c
                        d %= 120
                        b += d
                        b %= 120
                    r_set.add(b)
    print(len(r_set))      




if __name__ == "__main__":
    main()
0