結果

問題 No.346 チワワ数え上げ問題
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-27 16:59:14
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 676 bytes
コンパイル時間 13,160 ms
コンパイル使用メモリ 167,164 KB
実行使用メモリ 55,040 KB
最終ジャッジ日時 2024-04-15 04:11:32
合計ジャッジ時間 15,357 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
30,848 KB
testcase_01 AC 41 ms
55,040 KB
testcase_02 AC 43 ms
27,112 KB
testcase_03 AC 42 ms
27,136 KB
testcase_04 AC 42 ms
27,520 KB
testcase_05 AC 41 ms
27,124 KB
testcase_06 AC 42 ms
27,008 KB
testcase_07 AC 42 ms
27,136 KB
testcase_08 AC 41 ms
27,128 KB
testcase_09 AC 43 ms
27,392 KB
testcase_10 WA -
testcase_11 AC 138 ms
27,648 KB
testcase_12 WA -
testcase_13 AC 121 ms
27,740 KB
testcase_14 AC 44 ms
27,264 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (282 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

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

namespace yukicoder
{
	public class Program
	{
		public static void Main()
		{
			var c = Console.ReadLine();
			var sum = 0;
            if (c.Length > 2)
            {
				for (var i = 0; i < c.Length - 2; i++)
				{
                    if (c[i] == 'c')
                    {
						var w = 0;
						for(var j = i + 1; j < c.Length; j++)
                        {
                            if (c[j] == 'w')
                            {
								w++;
                            }
                        }
						sum += w * (w - 1) / 2;
                    }
				}
			}
			Console.WriteLine(sum);
		}
	}
}
0