結果

問題 No.933 おまわりさんこいつです
ユーザー ProgrammerryokiProgrammerryoki
提出日時 2019-11-29 23:01:30
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 707 ms / 2,000 ms
コード長 849 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 21,660 KB
最終ジャッジ日時 2023-08-13 06:50:02
合計ジャッジ時間 3,209 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,792 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 15 ms
7,800 KB
testcase_03 AC 15 ms
7,832 KB
testcase_04 AC 15 ms
7,732 KB
testcase_05 AC 15 ms
7,872 KB
testcase_06 AC 15 ms
7,796 KB
testcase_07 AC 15 ms
7,800 KB
testcase_08 AC 16 ms
7,828 KB
testcase_09 AC 15 ms
7,828 KB
testcase_10 AC 15 ms
7,760 KB
testcase_11 AC 16 ms
7,832 KB
testcase_12 AC 15 ms
7,872 KB
testcase_13 AC 17 ms
8,200 KB
testcase_14 AC 18 ms
8,672 KB
testcase_15 AC 24 ms
9,108 KB
testcase_16 AC 81 ms
11,460 KB
testcase_17 AC 40 ms
17,004 KB
testcase_18 AC 15 ms
7,920 KB
testcase_19 AC 46 ms
19,380 KB
testcase_20 AC 331 ms
9,976 KB
testcase_21 AC 15 ms
7,912 KB
testcase_22 AC 15 ms
7,828 KB
testcase_23 AC 490 ms
21,660 KB
testcase_24 AC 707 ms
21,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 0:
    print("0")
else:
    s = [int(i) for i in input().split()]
    if 0 in s:
        print("0")
    else:
        c = 1
        cs = 0
        for a in s:
            m = a%9
            if m != 0:
                c *= m
            else:
                c *= 9
        # print(c)
        # print("mod",c%9)
        print(c%9 if c%9 != 0 else 9)
        # su = sum([int(i) for i in str(c)])
        # while len(str(su)) > 1:
        #     print("su",su)
        #     su = sum([int(i) for i in str(su)])
        # print("ans",su)

        # c = 1
        # cs = 0
        # for a in s:
        #     su = a
        #     while len(str(su)) > 1:
        #         su = sum([int(i) for i in str(su)])
        #     c *= su
        #     print("c",sum([int(i) for i in str(c)]))
        #     cs += su
        # print(c,cs)
0