結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-06-27 14:44:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 945 bytes |
コンパイル時間 | 791 ms |
コンパイル使用メモリ | 102,272 KB |
実行使用メモリ | 18,432 KB |
最終ジャッジ日時 | 2024-06-27 23:35:18 |
合計ジャッジ時間 | 2,749 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 14 RE * 6 |
コンパイルメッセージ
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;i<input.Length;i++) { string temp = input.Substring(i, 1); if(temp=="w") { wcnt++; if(wcnt==2) { length = i+1; break; } } } if (length != -1) { Console.WriteLine(length - cnum); } else { Console.WriteLine("-1"); } } } }