結果
問題 | No.1292 パタパタ三角形 |
ユーザー | gmm_tea |
提出日時 | 2020-11-26 02:19:02 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 506 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 11,412 KB |
実行使用メモリ | 43,472 KB |
最終ジャッジ日時 | 2023-10-01 02:08:13 |
合計ジャッジ時間 | 4,974 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
15,008 KB |
testcase_01 | AC | 81 ms
15,248 KB |
testcase_02 | AC | 79 ms
15,140 KB |
testcase_03 | WA | - |
testcase_04 | AC | 78 ms
15,100 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 | AC | 299 ms
43,336 KB |
testcase_14 | AC | 305 ms
37,132 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
s=gets.chomp.chars l=[[0,0]] r=0 s.each do |c| if l[-1][1].even? if (c.ord-97+r)%3==0 l << [l[-1][0]-1,l[-1][1]+1] elsif (c.ord-97+r)%3==1 l << [l[-1][0],l[-1][1]+1] r=(r+1)%3 else l << [l[-1][0],l[-1][1]-1] r=(r-1)%3 end else if (c.ord-97+r)%3==0 l << [l[-1][0]+1,l[-1][1]-1] elsif (c.ord-97+r)%3==1 l << [l[-1][0],l[-1][1]-1] r=(r-1)%3 else l << [l[-1][0],l[-1][1]+1] r=(r+1)%3 end end end puts l.uniq.size