結果

問題 No.1292 パタパタ三角形
ユーザー gmm_teagmm_tea
提出日時 2020-11-22 00:39:11
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 11,432 KB
実行使用メモリ 43,224 KB
最終ジャッジ日時 2023-09-30 22:21:27
合計ジャッジ時間 5,593 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,160 KB
testcase_01 AC 85 ms
15,068 KB
testcase_02 AC 81 ms
15,292 KB
testcase_03 AC 82 ms
15,208 KB
testcase_04 AC 82 ms
15,148 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 337 ms
39,316 KB
testcase_15 AC 353 ms
43,224 KB
testcase_16 AC 355 ms
43,224 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s=gets.chomp.chars
l=[[0,0]]
s.each do |c|
  if l[-1][1].even?
    if c=="a"
      l << [l[-1][0]-1,l[-1][1]+1]
    elsif c=="b"
      l << [l[-1][0],l[-1][1]+1]
    else
      l << [l[-1][0],l[-1][1]-1]
    end
  else
    if c=="a"
      l << [l[-1][0]+1,l[-1][1]-1]
    elsif c=="b"
      l << [l[-1][0],l[-1][1]-1]
    else
      l << [l[-1][0],l[-1][1]+1]
    end
  end
end
puts l.uniq.size
0