結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2017-12-14 23:37:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-14 13:37:59 |
合計ジャッジ時間 | 1,942 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 20 WA * 9 |
ソースコード
s = input() s += 'x' l = [] count = 0 temp = '' min = 100 for i in range(len(s)): count = 0 temp = '' if s[i] == 'c' and not s[i + 1] == 'c': temp += 'c' for j in range(i+1, len(s)): if temp[-1] == 'c' and s[j] == 'c': break else: temp += s[j] if s[j] == 'w': count += 1 if count == 2: break l.append(temp) for i in l: if i.count('w') == 2 and len(i) < min: min = len(i) if min: print(min) else: print(-1)