結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-27 14:30:58 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 551 bytes |
| コンパイル時間 | 874 ms |
| コンパイル使用メモリ | 103,680 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-11-21 20:49:51 |
| 合計ジャッジ時間 | 2,328 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
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();
}
}