結果
問題 | No.345 最小チワワ問題 |
ユーザー |
|
提出日時 | 2025-01-21 19:45:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 533 bytes |
コンパイル時間 | 634 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2025-01-21 19:45:28 |
合計ジャッジ時間 | 2,710 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 21 |
ソースコード
def main(): s = list(input()) if not (False in [i not in "c" for i in s] and False in [i not in "w" for i in s]): print(-1) else: pass for i, word in enumerate(s): if word == "c": break else: pass del s[:i] w_count = 0 for i, word in enumerate(s): if word == "w" and w_count == 0: w_count += 1 elif word == "w" and w_count == 1: w_count += 1 break else: pass if w_count == 2: print(i+1) else: print(-1) if __name__ == "__main__": main()