結果
問題 | No.345 最小チワワ問題 |
ユーザー | punyfix |
提出日時 | 2017-09-19 17:23:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 431 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-09-25 12:03:32 |
合計ジャッジ時間 | 1,865 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
S = input() indexw = [i for i, x in enumerate(S) if x == "w"] indexc = [i for i, x in enumerate(S) if x == "c"] chikuwa = [] for i in indexc: for j in range(100): if len(indexw) > 0: if i >= indexw[0]: indexw.pop(0) else: break if len(indexw) >= 2: chikuwa.append(indexw[1] - i + 1) if len(chikuwa) <= 0: print(-1) else: print(min(chikuwa))