結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-27 17:53:40 |
| 言語 | C# (.NET 10.0.201) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 433 bytes |
| 記録 | |
| コンパイル時間 | 6,115 ms |
| コンパイル使用メモリ | 172,372 KB |
| 実行使用メモリ | 191,136 KB |
| 最終ジャッジ日時 | 2026-04-20 11:25:37 |
| 合計ジャッジ時間 | 9,153 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (88 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
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);
}
}
}