結果

問題 No.346 チワワ数え上げ問題
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-27 17:53:40
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 9,993 ms
コンパイル使用メモリ 169,668 KB
実行使用メモリ 179,852 KB
最終ジャッジ日時 2024-04-15 04:56:39
合計ジャッジ時間 9,704 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
27,008 KB
testcase_01 AC 41 ms
26,752 KB
testcase_02 AC 41 ms
26,752 KB
testcase_03 AC 42 ms
27,008 KB
testcase_04 AC 41 ms
26,752 KB
testcase_05 AC 42 ms
26,752 KB
testcase_06 AC 41 ms
27,124 KB
testcase_07 AC 40 ms
26,880 KB
testcase_08 AC 40 ms
27,136 KB
testcase_09 AC 39 ms
26,752 KB
testcase_10 AC 42 ms
28,032 KB
testcase_11 AC 43 ms
27,776 KB
testcase_12 AC 45 ms
28,032 KB
testcase_13 AC 43 ms
27,776 KB
testcase_14 AC 42 ms
27,008 KB
testcase_15 AC 44 ms
27,892 KB
testcase_16 AC 45 ms
27,776 KB
testcase_17 AC 45 ms
27,904 KB
testcase_18 AC 44 ms
27,904 KB
testcase_19 AC 43 ms
27,904 KB
testcase_20 AC 45 ms
28,032 KB
testcase_21 AC 44 ms
27,904 KB
testcase_22 AC 44 ms
28,032 KB
testcase_23 AC 42 ms
27,008 KB
testcase_24 AC 42 ms
27,124 KB
testcase_25 AC 41 ms
179,852 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (90 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();
			long sum = 0;
			long w = 0;
			for (var i = c.Length - 1; i >= 0; i--)
			{
                if (c[i] == 'w')
				{
					w++;
				}
				else if (c[i] == 'c')
                {
					sum += w * (w - 1) / 2;
				}
			}
			Console.WriteLine(sum);
		}
	}
}
0