結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-16 12:10:38 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 750 bytes |
| 記録 | |
| コンパイル時間 | 53 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2026-11-16 12:10:42 |
| 合計ジャッジ時間 | 2,624 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 23 WA * 8 |
ソースコード
#最初にcを観測して、次に現れるwとその次に現れるwを観測するといい #何文字目かを知りたいので、リストにしてから何番目の要素かを出力すると良さそう #1.文字列のリスト化 #2.特定文字の観測と何番目かの出力 #3.要素の引き算 s = input() ans = 111 lst = list(s) lenth = len(lst) for index,item in enumerate(lst): if item == "c": c = index for index,item in enumerate(lst): if item == "w" and index > c: w = index for index,item in enumerate(lst): if item == "w" and index > w: ww = index if ww - c + 1 < ans: ans = ww - c + 1 if item == "w" and index > ww: www = index if ans == 111: ans == -1 print(ans)