結果

問題 No.346 チワワ数え上げ問題
ユーザー HimatsubushinHimatsubushin
提出日時 2016-03-09 08:16:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 942 bytes
コンパイル時間 3,053 ms
コンパイル使用メモリ 106,844 KB
実行使用メモリ 24,020 KB
最終ジャッジ日時 2023-10-24 21:22:27
合計ジャッジ時間 3,334 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
23,580 KB
testcase_01 AC 21 ms
23,576 KB
testcase_02 AC 21 ms
23,576 KB
testcase_03 AC 21 ms
23,576 KB
testcase_04 AC 20 ms
23,580 KB
testcase_05 AC 20 ms
23,580 KB
testcase_06 AC 20 ms
23,576 KB
testcase_07 AC 20 ms
23,576 KB
testcase_08 AC 21 ms
23,576 KB
testcase_09 AC 20 ms
23,580 KB
testcase_10 AC 21 ms
23,496 KB
testcase_11 AC 21 ms
23,496 KB
testcase_12 AC 21 ms
23,496 KB
testcase_13 AC 22 ms
23,496 KB
testcase_14 AC 20 ms
23,496 KB
testcase_15 AC 21 ms
23,496 KB
testcase_16 AC 23 ms
23,496 KB
testcase_17 AC 22 ms
23,496 KB
testcase_18 AC 21 ms
23,496 KB
testcase_19 AC 21 ms
23,496 KB
testcase_20 AC 23 ms
24,020 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 21 ms
23,576 KB
testcase_24 AC 20 ms
23,576 KB
testcase_25 AC 20 ms
23,576 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace No346
{
    class Program
    {
        static void Main(string[] args)
        {
            int count_c = 0;
            List<int> count_w = new List<int>();
            long num = 0;
            int count = 0;
            string text = Console.ReadLine();

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i] == 'c')
                {
                    count_w.Add(count_c);
                    count_c = 0;
                }

                if (text[i] == 'w')
                    count_c++;
            }
            count_w.Add(count_c);

            for (int i = count_w.Count - 1; i > 0; i--)
            {
                count += count_w[i];
                if (count > 1)
                {
                    num += count * (count - 1) / 2;
                }
            }

            Console.WriteLine(num);
        }
    }
}
0