結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-31 09:29:24 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 554 bytes |
| コンパイル時間 | 147 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-12-31 09:29:26 |
| 合計ジャッジ時間 | 2,187 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
def main():
s = input()
length_minimom = float('inf')
for c in range(len(s)):
if s[c] == 'c':
count_cww = 0
for w in range(c+1, len(s)):
if s[w] == 'w':
count_cww += 1
if count_cww == 2:
length_minimom = min(length_minimom, w - c + 1)
break
if length_minimom == float('inf'):
print(-1)
else:
print(length_minimom)
if __name__ == '__main__':
main()