結果
問題 |
No.201 yukicoderじゃんけん
|
ユーザー |
![]() |
提出日時 | 2016-06-06 13:09:18 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 379 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-08 16:33:36 |
合計ジャッジ時間 | 3,008 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 WA * 2 |
コンパイルメッセージ
Main.rb:24: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:32: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
def f(x) case x when "R" return 0 when "S" return 1 when "P" return 2 else return -1 end end as=[[-1,0,1],[1,-1,0],[0,1,-1]] sa,pa,xa=STDIN.gets.split(" ") sb,pb,xb=STDIN.gets.split(" ") sc=[sa,sb] pa=pa.to_i pb=pb.to_i if pa==0 && pb==0 puts -1 elsif pa>pb puts sa elsif pa<pb puts sb else t=as[f(xa)][f(xb)] if t==-1 puts -1 else puts sc[t] end end