結果

問題 No.346 チワワ数え上げ問題
ユーザー mesame3993mesame3993
提出日時 2021-09-16 08:21:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,724 ms / 2,000 ms
コード長 197 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 8,344 KB
最終ジャッジ日時 2023-09-12 00:56:45
合計ジャッジ時間 6,426 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 16 ms
7,836 KB
testcase_02 AC 17 ms
7,956 KB
testcase_03 AC 16 ms
7,868 KB
testcase_04 AC 16 ms
7,804 KB
testcase_05 AC 15 ms
7,936 KB
testcase_06 AC 15 ms
7,748 KB
testcase_07 AC 15 ms
7,772 KB
testcase_08 AC 15 ms
7,908 KB
testcase_09 AC 16 ms
7,800 KB
testcase_10 AC 229 ms
8,344 KB
testcase_11 AC 92 ms
8,084 KB
testcase_12 AC 146 ms
8,104 KB
testcase_13 AC 76 ms
8,136 KB
testcase_14 AC 16 ms
7,824 KB
testcase_15 AC 132 ms
8,148 KB
testcase_16 AC 169 ms
8,072 KB
testcase_17 AC 226 ms
8,208 KB
testcase_18 AC 222 ms
8,264 KB
testcase_19 AC 176 ms
8,172 KB
testcase_20 AC 15 ms
8,048 KB
testcase_21 AC 1,723 ms
8,216 KB
testcase_22 AC 1,724 ms
8,172 KB
testcase_23 AC 15 ms
7,952 KB
testcase_24 AC 15 ms
8,120 KB
testcase_25 AC 16 ms
7,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)
ans = 0
w = s.count('w')
if w <= 1:
	print(ans)
	exit()

for i in range(n):
	if s[i] == 'c':
		tmp = s[i:]
		w = tmp.count('w')
		if w >= 2:
			ans += w*(w-1) // 2
print(ans)
0