結果

問題 No.436 ccw
ユーザー jousen
提出日時 2016-10-28 22:37:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 1,108 bytes
コンパイル時間 750 ms
コンパイル使用メモリ 109,828 KB
実行使用メモリ 27,420 KB
最終ジャッジ日時 2024-11-24 05:48:23
合計ジャッジ時間 2,296 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();




            //var n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            string s = Console.ReadLine();

            var list = new List<int>();

            int index = -1;
            while(true)
            {
                index = s.IndexOf("ccw", index+1);
                if (index >= 0) list.Add(index);
                else break;
            }

            int min = 0;
            for(int i =0; i<list.Count(); i++)
            {
                //int tmp = list[i] + s.Length - (list[i] + 2);
                min = Math.Min(list[i]+1 , s.Length - (list[i] + 2));
            }

            Console.WriteLine(min);

            





            //Console.Read();


        }

    }


}
0