結果

問題 No.346 チワワ数え上げ問題
ユーザー NoNo
提出日時 2016-06-09 19:12:13
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 575 bytes
コンパイル時間 1,959 ms
コンパイル使用メモリ 112,680 KB
実行使用メモリ 49,952 KB
最終ジャッジ日時 2024-04-17 12:16:46
合計ジャッジ時間 20,226 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,064 KB
testcase_01 AC 26 ms
18,432 KB
testcase_02 AC 25 ms
18,688 KB
testcase_03 AC 25 ms
18,560 KB
testcase_04 AC 25 ms
18,560 KB
testcase_05 AC 22 ms
18,176 KB
testcase_06 AC 26 ms
18,560 KB
testcase_07 AC 24 ms
18,688 KB
testcase_08 AC 23 ms
18,432 KB
testcase_09 AC 24 ms
18,688 KB
testcase_10 TLE -
testcase_11 AC 853 ms
35,320 KB
testcase_12 AC 1,488 ms
35,420 KB
testcase_13 AC 696 ms
35,452 KB
testcase_14 AC 29 ms
19,200 KB
testcase_15 AC 1,327 ms
36,452 KB
testcase_16 AC 1,748 ms
35,440 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 AC 1,856 ms
35,448 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Text;
using System.Threading.Tasks;

namespace yukikoda
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            long ans = 0;

            for (int i = 0; i < s.Length; i++)
            {
                if (!s[i].Equals('c')) continue;
                long w = s.Substring(i).Where(x => x.Equals('w')).Count();
                ans += w * (w - 1 ) / 2;
            }
            Console.WriteLine(ans);
        }
    }
}
0