結果
| 問題 |
No.2021 Not A but B
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-05 01:22:36 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 472 bytes |
| コンパイル時間 | 16,137 ms |
| コンパイル使用メモリ | 167,776 KB |
| 実行使用メモリ | 198,024 KB |
| 最終ジャッジ日時 | 2024-11-22 14:30:13 |
| 合計ジャッジ時間 | 13,958 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (99 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;
class Program
{
static void Main(string[] args)
{
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine() + "C";
var count = 0;
for (int i = 0; i < N - 1; i++)
{
if (S.Substring(i, 2) != "BB" && S.Substring(i, 3) != "BAB") count++;
}
if (S.Contains("BB")) count++;
Console.WriteLine(count);
}
}