codeFlyer (bitFlyer Programming Contest)

Submission #10075055

Source codeソースコード

# https://atcoder.jp/contests/bitflyer2018-qual/tasks/bitflyer2018_qual_b



A, B, N = gets.split.map(&:to_i)
X = gets.chomp

short_cake = A
cheese_cake = B

X.chars do |char|
  case char
  when 'S'
    short_cake -= 1 if short_cake > 0
  when 'C'
    cheese_cake -= 1 if cheese_cake > 0
  when 'E'
    if short_cake >= cheese_cake
      short_cake -= 1 if short_cake > 0
    else
      cheese_cake -= 1 if cheese_cake > 0
    end
  end
  break if short_cake == 0 && cheese_cake == 0
end

puts short_cake
puts cheese_cake

Submission

Task問題 B - 洋菓子店
User nameユーザ名 tanaken0515
Created time投稿日時
Language言語 Ruby (2.3.3)
Status状態 AC
Score得点 200
Source lengthソースコード長 522 Byte
File nameファイル名
Exec time実行時間 28 ms
Memory usageメモリ使用量 1916 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample-01.txt,sample-02.txt,sample-03.txt,sample-04.txt
All 200 / 200 01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,sample-01.txt,sample-02.txt,sample-03.txt,sample-04.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01.txt AC 24 ms 1916 KB
02.txt AC 18 ms 1916 KB
03.txt AC 20 ms 1916 KB
04.txt AC 20 ms 1916 KB
05.txt AC 12 ms 1788 KB
06.txt AC 28 ms 1916 KB
07.txt AC 9 ms 1916 KB
08.txt AC 7 ms 1788 KB
sample-01.txt AC 7 ms 1788 KB
sample-02.txt AC 7 ms 1788 KB
sample-03.txt AC 7 ms 1788 KB
sample-04.txt AC 7 ms 1788 KB