結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-27 17:53:40 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 2,000 ms |
| コード長 | 433 bytes |
| コンパイル時間 | 16,044 ms |
| コンパイル使用メモリ | 170,072 KB |
| 実行使用メモリ | 179,656 KB |
| 最終ジャッジ日時 | 2024-10-04 16:50:19 |
| 合計ジャッジ時間 | 18,568 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (123 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/
ソースコード
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);
}
}
}