Submission #533456


Source Code Expand

n = gets.to_i
str = ['tokyo', 'kyoto']
n.times do |i|
  st = "a" + gets.chomp + "b"

  s = st.split('kyo')
  # s = [a, to, abc, d, to, c, b]
  p s

  res = 0
  flag0 = 0
  flag1 = 0
  for j in (0...s.size) do
    if s[j].size >= 2
      flag0 = 0
      if s[j][0..1] == 'to'
        if flag1 == 1
        else
          res += 1
          flag0 = 1
        end
      end

      flag1 = 0
      if s[j][-2..-1] == 'to'
        if s.size == 2 && flag0 == 1
        else
          res += 1
          flag1 = 1
        end
      end
    end
  end
  p res
end

Submission Info

Submission Time
Task A - 東京都
User amitest_
Language Ruby (2.1.5p273)
Score 0
Code Size 592 Byte
Status WA
Exec Time 65 ms
Memory 5480 KB

Compile Error

./Main.rb:2: warning: assigned but unused variable - str

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 3
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
10_random_to_kyo.txt WA 65 ms 5480 KB
20_noised_tokyoto.txt WA 64 ms 5356 KB
99_teuchi.txt WA 61 ms 5224 KB