結果

問題 No.1159 Sashiming String
ユーザー brthyyjpbrthyyjp
提出日時 2021-04-29 17:42:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 93,632 KB
最終ジャッジ日時 2023-09-23 02:32:47
合計ジャッジ時間 3,301 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,292 KB
testcase_01 AC 72 ms
71,280 KB
testcase_02 AC 104 ms
84,696 KB
testcase_03 AC 99 ms
93,632 KB
testcase_04 AC 88 ms
83,868 KB
testcase_05 AC 93 ms
87,200 KB
testcase_06 AC 87 ms
83,688 KB
testcase_07 AC 92 ms
87,232 KB
testcase_08 AC 102 ms
90,632 KB
testcase_09 AC 100 ms
93,248 KB
testcase_10 AC 72 ms
71,164 KB
testcase_11 AC 71 ms
70,924 KB
testcase_12 AC 74 ms
71,412 KB
testcase_13 AC 72 ms
71,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = str(input())
n = len(s)
if n < 4:
    print(0)
    exit()
C = [0]*n
for i, c in enumerate(s):
    if c == 'S':
        C[i] += 1
from itertools import accumulate
C = [0]+C
C = list(accumulate(C))
ans = 0
for i in range(n-3+1):
    if s[i] == 'i' and s[i+1] == 'n' and s[i+2] == 'g':
        ans += C[i]
print(ans)
0