結果

問題 No.1765 While Shining
ユーザー アナスタシアアナスタシア
提出日時 2021-12-06 21:50:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 11,340 KB
最終ジャッジ日時 2023-09-21 15:48:06
合計ジャッジ時間 3,064 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,764 KB
testcase_01 AC 17 ms
7,920 KB
testcase_02 AC 17 ms
7,940 KB
testcase_03 AC 16 ms
7,788 KB
testcase_04 AC 16 ms
7,788 KB
testcase_05 AC 16 ms
7,712 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 15 ms
7,788 KB
testcase_08 AC 16 ms
7,712 KB
testcase_09 AC 68 ms
10,208 KB
testcase_10 AC 96 ms
11,252 KB
testcase_11 AC 83 ms
10,988 KB
testcase_12 AC 87 ms
11,060 KB
testcase_13 AC 80 ms
10,920 KB
testcase_14 AC 98 ms
11,280 KB
testcase_15 AC 98 ms
11,296 KB
testcase_16 AC 99 ms
11,312 KB
testcase_17 AC 98 ms
11,340 KB
testcase_18 AC 96 ms
11,300 KB
testcase_19 AC 95 ms
11,336 KB
testcase_20 AC 95 ms
11,304 KB
testcase_21 AC 96 ms
11,228 KB
testcase_22 AC 98 ms
11,328 KB
testcase_23 AC 98 ms
11,280 KB
testcase_24 AC 99 ms
11,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
As = list(map(int, input().split()))

total, value = 0, 0
target = 1

for a in As[:-1]:
    if a == 1:
        if target == 1:
            value += 1
            target = 0
        else:
            value = 1
    else:
        if target == 0:
            pass
        else:
            value = 0
        target = 1
    total += value

print(total)
0