結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2016-03-08 22:09:14 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 441 bytes |
| 記録 | |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 95,568 KB |
| 実行使用メモリ | 319,512 KB |
| 最終ジャッジ日時 | 2026-09-03 07:39:53 |
| 合計ジャッジ時間 | 7,021 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 21 TLE * 1 -- * 1 |
ソースコード
def solve():
s = input()
cl, wl = [], []
slen = len(s)
for i in range(slen):
if s[i] == "c":
cl.append(i)
continue
elif s[i] == "w":
wl.append(i)
res = 0
for cidx in cl:
wl = [i for i in wl if i > cidx]
wlen = len(wl)
if wlen < 2:
break
res += (wlen * (wlen-1)) // 2
print(res)
if __name__=="__main__":
solve()