結果

問題 No.345 最小チワワ問題
ユーザー chankou0920chankou0920
提出日時 2017-10-27 14:30:58
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 2,016 ms
コンパイル使用メモリ 100,924 KB
実行使用メモリ 24,588 KB
最終ジャッジ日時 2023-08-14 02:52:23
合計ジャッジ時間 4,380 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
20,632 KB
testcase_01 AC 41 ms
20,592 KB
testcase_02 AC 43 ms
20,704 KB
testcase_03 AC 41 ms
18,468 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 43 ms
20,512 KB
testcase_08 AC 45 ms
22,640 KB
testcase_09 AC 45 ms
20,712 KB
testcase_10 AC 41 ms
20,592 KB
testcase_11 AC 42 ms
20,712 KB
testcase_12 AC 42 ms
20,460 KB
testcase_13 AC 42 ms
20,492 KB
testcase_14 WA -
testcase_15 AC 41 ms
20,536 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 42 ms
22,628 KB
testcase_20 AC 41 ms
20,556 KB
testcase_21 AC 43 ms
22,544 KB
testcase_22 AC 41 ms
22,560 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 43 ms
18,464 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 42 ms
20,604 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
	public void Solve() {
		char[] c = Console.ReadLine().ToCharArray();
		char[] cww = {'c', 'w', 'w'};
		int index = 0;
		int count = 0;
		bool flag = false;
		for (int i = 0; i < c.Length; i++) {
			if (c[i].Equals(cww[index])) {
				flag = true;
				index++;
			}
			if (flag) {
				count++;
				if (index == cww.Length) {
					Console.WriteLine(count);
					return;
				}
			}
		}
		Console.WriteLine(-1);
	}
	
	public static void Main(string[] args) {
		Program program = new Program();
		program.Solve();
	}
}
0