結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2016-10-12 11:16:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 464 bytes |
コンパイル時間 | 788 ms |
コンパイル使用メモリ | 102,784 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-11-22 02:36:59 |
合計ジャッジ時間 | 2,469 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; class Program { static void Main(string[] args) { // No.345 最小チワワ問題 string S = Console.ReadLine(); int cIdx = -1, wIdx = -1; cIdx = S.IndexOf('c'); wIdx = S.IndexOf('w', cIdx + 1); wIdx = S.IndexOf('w', wIdx + 1); if (cIdx == -1 || wIdx == -1) Console.WriteLine(-1); else Console.WriteLine(wIdx - cIdx + 1); } }