結果

問題 No.1632 Sorting Integers (GCD of M)
ユーザー tamatotamato
提出日時 2021-07-31 10:48:38
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,173 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 79,272 KB
最終ジャッジ日時 2023-10-14 14:36:57
合計ジャッジ時間 8,155 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,808 KB
testcase_01 AC 72 ms
71,636 KB
testcase_02 RE -
testcase_03 AC 72 ms
71,756 KB
testcase_04 AC 73 ms
71,544 KB
testcase_05 AC 73 ms
71,352 KB
testcase_06 AC 73 ms
71,568 KB
testcase_07 AC 73 ms
71,584 KB
testcase_08 AC 73 ms
71,320 KB
testcase_09 AC 74 ms
71,444 KB
testcase_10 AC 73 ms
71,412 KB
testcase_11 AC 74 ms
71,360 KB
testcase_12 AC 73 ms
71,472 KB
testcase_13 AC 75 ms
71,784 KB
testcase_14 AC 74 ms
71,740 KB
testcase_15 AC 73 ms
71,468 KB
testcase_16 AC 76 ms
71,676 KB
testcase_17 AC 73 ms
71,552 KB
testcase_18 AC 77 ms
71,348 KB
testcase_19 WA -
testcase_20 AC 74 ms
71,324 KB
testcase_21 WA -
testcase_22 AC 73 ms
71,756 KB
testcase_23 AC 73 ms
71,412 KB
testcase_24 AC 73 ms
71,608 KB
testcase_25 AC 73 ms
71,740 KB
testcase_26 WA -
testcase_27 AC 73 ms
71,348 KB
testcase_28 AC 74 ms
71,492 KB
testcase_29 AC 73 ms
71,612 KB
testcase_30 AC 74 ms
71,544 KB
testcase_31 AC 74 ms
71,656 KB
testcase_32 AC 74 ms
71,620 KB
testcase_33 AC 75 ms
71,604 KB
testcase_34 WA -
testcase_35 AC 73 ms
71,748 KB
testcase_36 AC 73 ms
71,816 KB
testcase_37 WA -
testcase_38 AC 74 ms
71,672 KB
testcase_39 AC 74 ms
71,808 KB
testcase_40 AC 74 ms
71,356 KB
testcase_41 AC 76 ms
71,560 KB
testcase_42 AC 76 ms
71,664 KB
testcase_43 WA -
testcase_44 AC 77 ms
71,468 KB
testcase_45 AC 77 ms
71,684 KB
testcase_46 WA -
testcase_47 AC 76 ms
71,608 KB
testcase_48 AC 73 ms
71,328 KB
testcase_49 AC 75 ms
71,492 KB
testcase_50 AC 79 ms
71,768 KB
testcase_51 AC 73 ms
71,264 KB
testcase_52 AC 74 ms
71,812 KB
testcase_53 AC 74 ms
71,316 KB
testcase_54 AC 73 ms
71,596 KB
testcase_55 AC 74 ms
71,568 KB
testcase_56 AC 74 ms
71,656 KB
testcase_57 AC 73 ms
71,700 KB
testcase_58 AC 75 ms
71,600 KB
testcase_59 RE -
testcase_60 RE -
testcase_61 RE -
testcase_62 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    C = [0] + list(map(int, input().split()))

    nz = [0] * 10
    for i in range(1, 10):
        if C[i]:
            nz[i] = 1
    if sum(nz) == 1:
        c = 0
        for i in range(1, 10):
            if nz[i]:
                c = i
                break
        print((c * (pow(10, N, mod) - 1) * pow(9, mod-2, mod))%mod)
        assert False
        exit()

    ans = 1
    # 2
    flg2 = 1
    for i in range(1, 10):
        if i % 2 and C[i]:
            flg2 = 0
            break
    if flg2:
        ans = 2

    # 4
    flg4 = 1
    for i in range(1, 10):
        if i % 4 and C[i]:
            flg4 = 0
            break
    if flg4:
        ans = 4

    # 3, 9
    S = 0
    for i, c in enumerate(C):
        S = S + c * i
    if S % 9 == 0:
        ans *= 9
    elif S % 3 == 0:
        ans *= 3

    # 7
    T = set()
    for i in range(1, 10):
        if C[i]:
            T.add(i)
    T = sorted(list(T))
    if T == [1, 8] or T == [2, 9]:
        if N % 6 == 0:
            ans *= 7
    print(ans)


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