結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-27 16:59:14 |
| 言語 | C# (.NET 10.0.201) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 676 bytes |
| 記録 | |
| コンパイル時間 | 7,434 ms |
| コンパイル使用メモリ | 174,072 KB |
| 実行使用メモリ | 191,120 KB |
| 最終ジャッジ日時 | 2026-04-20 09:53:02 |
| 合計ジャッジ時間 | 15,086 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 9 TLE * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (131 ミリ秒)。 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();
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);
}
}
}