結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-06-27 14:49:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 945 bytes |
コンパイル時間 | 1,677 ms |
コンパイル使用メモリ | 102,912 KB |
実行使用メモリ | 18,432 KB |
最終ジャッジ日時 | 2024-06-27 23:45:37 |
合計ジャッジ時間 | 3,569 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 10 WA * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoderTest { class Program { static void Main(string[] args) { string input = Console.ReadLine(); int cnum = input.IndexOf("c", 0); int wcnt = 0; int length = -1; for(int i=cnum+1;i<input.Length;i++) { string temp = input.Substring(i, 1); if(temp=="w") { wcnt++; if(wcnt==2) { length = i; break; } } } if (length != -1) { Console.WriteLine(length - cnum); } else { Console.WriteLine("-1"); } } } }