結果

問題 No.1159 Sashiming String
ユーザー roarisroaris
提出日時 2020-08-12 16:49:08
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 86,712 KB
実行使用メモリ 91,884 KB
最終ジャッジ日時 2023-07-30 23:32:03
合計ジャッジ時間 2,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,268 KB
testcase_01 AC 73 ms
71,216 KB
testcase_02 AC 93 ms
84,188 KB
testcase_03 AC 96 ms
91,884 KB
testcase_04 AC 88 ms
83,848 KB
testcase_05 AC 93 ms
88,428 KB
testcase_06 AC 88 ms
83,912 KB
testcase_07 AC 91 ms
86,540 KB
testcase_08 AC 100 ms
91,764 KB
testcase_09 AC 99 ms
91,772 KB
testcase_10 AC 73 ms
71,260 KB
testcase_11 AC 73 ms
71,152 KB
testcase_12 AC 71 ms
71,272 KB
testcase_13 AC 72 ms
71,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

S = input()[:-1]
ing = [0]*len(S)

for i in range(len(S)-2):
    if S[i:i+3]=='ing':
        ing[i] = 1

acc = [0]

for ing_i in ing:
    acc.append(acc[-1]+ing_i)

ans = 0

for i in range(len(S)):
    if S[i]=='S':
        ans += acc[len(S)]-acc[i]

print(ans)
0