結果

問題 No.346 チワワ数え上げ問題
ユーザー ynyn
提出日時 2016-02-26 23:53:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 535 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 16,916 KB
最終ジャッジ日時 2023-10-24 10:54:08
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,104 KB
testcase_01 AC 30 ms
10,068 KB
testcase_02 AC 29 ms
10,068 KB
testcase_03 AC 29 ms
10,068 KB
testcase_04 AC 32 ms
10,080 KB
testcase_05 AC 29 ms
10,068 KB
testcase_06 AC 31 ms
10,076 KB
testcase_07 AC 35 ms
10,068 KB
testcase_08 AC 31 ms
10,072 KB
testcase_09 AC 32 ms
10,080 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
S = list(input())

c = [0] * len(S)
w = [0] * len(S)
ans = 0

for i in range(len(S)):
    if S[i] == "c":
        c[i] = 1

    if S[i] == "w":
        w[i] = 1

c_count = c.count(1)
c_index_bef = 0

for i in range(c_count):
    flag = 0
    w_count = 0
    c_index_cur = c.index(1)
    for j in range(c_index_bef, c_index_cur+1):
        c[j] = 0
        w[j] = 0

    w_count = w.count(1)
    if w_count < 2:
        break
    ans += (math.factorial(w_count)//(math.factorial(w_count-2) * math.factorial(2)))

print(ans)
0