結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
|
提出日時 | 2023-07-27 16:59:14 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 676 bytes |
コンパイル時間 | 9,898 ms |
コンパイル使用メモリ | 168,520 KB |
実行使用メモリ | 34,596 KB |
最終ジャッジ日時 | 2024-10-04 15:03:43 |
合計ジャッジ時間 | 17,103 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 13 WA * 7 TLE * 1 -- * 2 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (94 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(); 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); } } }