結果

問題 No.346 チワワ数え上げ問題
ユーザー NoaSaberNoaSaber
提出日時 2021-03-08 10:43:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 90,028 KB
最終ジャッジ日時 2024-04-18 02:05:58
合計ジャッジ時間 2,620 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,812 KB
testcase_01 AC 37 ms
52,656 KB
testcase_02 AC 40 ms
53,136 KB
testcase_03 AC 40 ms
52,424 KB
testcase_04 AC 40 ms
53,380 KB
testcase_05 AC 39 ms
53,092 KB
testcase_06 AC 41 ms
53,636 KB
testcase_07 AC 37 ms
52,888 KB
testcase_08 AC 43 ms
52,528 KB
testcase_09 AC 38 ms
53,344 KB
testcase_10 AC 80 ms
90,028 KB
testcase_11 AC 55 ms
71,872 KB
testcase_12 AC 57 ms
75,476 KB
testcase_13 AC 54 ms
69,944 KB
testcase_14 AC 47 ms
61,348 KB
testcase_15 AC 57 ms
73,296 KB
testcase_16 AC 60 ms
75,416 KB
testcase_17 AC 79 ms
89,648 KB
testcase_18 AC 80 ms
89,756 KB
testcase_19 AC 59 ms
75,232 KB
testcase_20 AC 55 ms
75,236 KB
testcase_21 AC 74 ms
89,692 KB
testcase_22 AC 76 ms
89,612 KB
testcase_23 AC 37 ms
52,688 KB
testcase_24 AC 38 ms
53,272 KB
testcase_25 AC 37 ms
51,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

l=list(input())
cnt=[[0]*2 for i in range(len(l)+1)]
for i in range(len(l)):
    a=l[i]
    cnt[i+1][0]=1 if a=="c" else 0
    cnt[i+1][1]=cnt[i][1]+(1 if a=="w" else 0)
ans=0
for i,j in cnt:
    ans+=i*(cnt[-1][1]-j)*(cnt[-1][1]-j-1)//2
print(ans)
0