結果

問題 No.346 チワワ数え上げ問題
ユーザー okazuki
提出日時 2016-02-29 20:32:19
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 925 bytes
コンパイル時間 2,658 ms
コンパイル使用メモリ 116,008 KB
実行使用メモリ 39,920 KB
最終ジャッジ日時 2024-09-24 12:53:24
合計ジャッジ時間 7,781 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var count = MakeCww(s)
                .Where(x => x == "cww")
                .Count();
            Console.WriteLine(count);
        }

        static IEnumerable<string> MakeCww(string s)
        {
            foreach (var a in s.Select((x, i) => new { Index = i, Value = x }))
            {
                foreach (var b in s.Where((_, i) => i != a.Index).Select((x, i) => new { Index = i, Value = x }).Skip(a.Index))
                {
                    foreach (var c in s.Where((_, i) => i != a.Index && i != b.Index).Skip(b.Index))
                    {
                        yield return $"{a.Value}{b.Value}{c}";
                    }
                }
            }
        }
    }
}
0