結果

問題 No.346 チワワ数え上げ問題
ユーザー NoNo
提出日時 2016-06-09 19:12:13
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 575 bytes
コンパイル時間 1,099 ms
コンパイル使用メモリ 110,564 KB
実行使用メモリ 45,488 KB
最終ジャッジ日時 2024-10-09 06:19:01
合計ジャッジ時間 21,378 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
32,384 KB
testcase_01 AC 27 ms
26,776 KB
testcase_02 AC 27 ms
26,900 KB
testcase_03 AC 26 ms
22,716 KB
testcase_04 AC 27 ms
24,748 KB
testcase_05 AC 24 ms
24,452 KB
testcase_06 AC 27 ms
25,008 KB
testcase_07 AC 26 ms
24,756 KB
testcase_08 AC 26 ms
24,696 KB
testcase_09 AC 26 ms
24,732 KB
testcase_10 TLE -
testcase_11 AC 890 ms
45,488 KB
testcase_12 AC 1,535 ms
43,388 KB
testcase_13 AC 707 ms
43,556 KB
testcase_14 AC 31 ms
24,728 KB
testcase_15 AC 1,366 ms
44,184 KB
testcase_16 AC 1,785 ms
43,548 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 AC 1,900 ms
35,440 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