結果

問題 No.436 ccw
ユーザー harhogefooharhogefoo
提出日時 2016-10-28 22:40:38
言語 Ruby
(3.4.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 300 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 24,576 KB
最終ジャッジ日時 2024-11-24 05:49:41
合計ジャッジ時間 14,256 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: assigned but unused variable - first
Main.rb:11: warning: assigned but unused variable - last
Syntax OK

ソースコード

diff #

s = gets.chomp

i = s.index("ccw")

if i == nil
  puts 0
  exit
end

first = 0
last = 0

fs = s.dup
ls = s.dup

count = 0
if i+1 < s.length / 2
  while fs.index("ccw") != nil
    fs[0] = ""
    count += 1
  end
else
  while ls.index("ccw") != nil
    ls[-1] = ""
    count += 1
  end
end

puts count
0