結果
| 問題 | 
                            No.1004 サイコロの実装 (2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             995himada
                         | 
                    
| 提出日時 | 2020-03-06 21:44:41 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 378 bytes | 
| コンパイル時間 | 138 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 19,232 KB | 
| 最終ジャッジ日時 | 2024-10-14 05:02:41 | 
| 合計ジャッジ時間 | 6,376 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 6 WA * 18 TLE * 1 -- * 13 | 
コンパイルメッセージ
Syntax OK
ソースコード
MOD = 2 ** 32
A, B, x0, N = gets.split.map(&:to_i)
@temp = x0
def randin
  @temp = (A * @temp + B) % MOD
  return @temp % 6 + 1
end
tk = [0,0]
aok = [0,0]
(N * 2).times do |i|
  if i.even?
    if randin.even?
      tk[0] += 1
    else
      tk[1] += 1
    end
  else
    if randin.even?
      aok[0] += 1
    else
      aok[1] += 1
    end
  end
end
puts "#{tk.min} #{aok.min}"
            
            
            
        
            
995himada