結果

問題 No.2021 Not A but B
ユーザー simansiman
提出日時 2022-07-30 08:31:00
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 244 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 11,308 KB
実行使用メモリ 21,380 KB
最終ジャッジ日時 2023-09-27 09:33:55
合計ジャッジ時間 5,685 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
19,412 KB
testcase_01 AC 81 ms
15,196 KB
testcase_02 AC 81 ms
15,264 KB
testcase_03 AC 80 ms
15,160 KB
testcase_04 AC 81 ms
15,152 KB
testcase_05 AC 82 ms
15,124 KB
testcase_06 AC 82 ms
15,244 KB
testcase_07 AC 80 ms
15,124 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
S = gets.chomp
s = S.dup

checked = Hash.new
ans = 0

0.upto(N - 2) do |i|
  s[i] = 'B'
  s[i + 1] = 'B'
  hash = s.hash
  s[i] = S[i]
  s[i + 1] = S[i + 1]

  next if checked[hash]
  checked[hash] = true
  ans += 1
end

puts ans
0