結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
|
提出日時 | 2017-10-15 17:12:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 791 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-11-17 17:52:33 |
合計ジャッジ時間 | 2,101 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 11 |
ソースコード
def main(): line = input() #chars = list(line) count = line.count('w') if count < 2: print(-1) return else: c_index = line.find('c') if c_index == -1: print(-1) return first_w_index = line.find('w') next_w_index = line.find('w', first_w_index+1) c_all_index = get_c_all_index(line) tmp = -1 for e in c_all_index: if e < first_w_index: tmp = e if tmp == -1: print(-1) else: print(next_w_index - tmp + 1) def get_c_all_index(line): c_all_index = [] for i in range(len(line)): if line[i] == 'c': c_all_index.append(i) return c_all_index if __name__ == '__main__': main()