結果
問題 | No.396 クラス替え |
ユーザー |
![]() |
提出日時 | 2016-12-01 15:00:35 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 77 ms / 1,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 397 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-11-27 15:47:04 |
合計ジャッジ時間 | 2,512 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - ac Main.rb:18: warning: assigned but unused variable - students Syntax OK
ソースコード
def class_div(a,b,c) ac = 0 if b == 0 then if a.odd? then ac = c else ac = 1 end else if a.odd? then ac = c + 1 - b else ac = b end end end students, classes = gets.split.map(&:to_i) hanako, taro = gets.split.map(&:to_i) h = hanako / classes hd = hanako % classes t = taro / classes td = taro % classes hc = class_div(h, hd, classes) tc = class_div(t, td, classes) if hc == tc then puts "YES" else puts "NO" end