結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-10 06:54:25 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 2,000 ms |
| コード長 | 292 bytes |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 12,392 KB |
| 最終ジャッジ日時 | 2024-09-23 05:27:12 |
| 合計ジャッジ時間 | 1,722 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
s = raw_input() arr = [] for i in s: if i == 'c' or i == 'w': arr.append(i) cs = [] t = 0 for i in range(len(arr)): if arr[i] == 'w': t += 1 cs.append(t) ans = 0 for i in range(len(arr)): if arr[i] == "c": count = cs[len(arr)-1] - cs[i] ans += count * (count-1)/2 print ans