結果
| 問題 |
No.3114 0→1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-19 22:49:30 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 566 bytes |
| コンパイル時間 | 6,761 ms |
| コンパイル使用メモリ | 172,600 KB |
| 実行使用メモリ | 47,012 KB |
| 最終ジャッジ日時 | 2025-04-19 22:49:52 |
| 合計ジャッジ時間 | 10,547 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 30 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (89 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.Text.RegularExpressions;
int n = int.Parse(Console.ReadLine());
string instr = Console.ReadLine();
int count = 0;
if (Regex.IsMatch(instr, @"000"))
{
count += Regex.Matches(instr, @"000").Count * 2;
instr = Regex.Replace(instr, @"000", "101");
}
if (Regex.IsMatch(instr, @"010"))
{
count += Regex.Matches(instr, @"010").Count;
instr = Regex.Replace(instr, @"010", "011");
}
if (Regex.IsMatch(instr, @"00"))
{
count += Regex.Matches(instr, @"00").Count;
instr = Regex.Replace(instr, @"00", "01");
}
Console.WriteLine(count);