結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-25 22:56:12 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 644 bytes |
| コンパイル時間 | 3,367 ms |
| コンパイル使用メモリ | 102,528 KB |
| 実行使用メモリ | 18,304 KB |
| 最終ジャッジ日時 | 2024-10-01 05:11:21 |
| 合計ジャッジ時間 | 2,855 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class Program
{
static void Main(string[] args)
{
var str = Console.ReadLine();
var result = Decimal.MaxValue;
int len = str.Length;
for (int i=0; i<len; i++)
{
for (int j=i+1; j< len; j++)
{
for (int k=j+1; k< len; k++)
{
if (str[i] == 'c' && str[j] == 'w' && str[k] == 'w')
{
result = Math.Min(result, k - i + 1);
}
}
}
}
Console.WriteLine((result == Decimal.MaxValue) ? -1 : result);
}
}