結果
| 問題 |
No.796 well known
|
| コンテスト | |
| ユーザー |
urutom
|
| 提出日時 | 2019-04-04 01:05:25 |
| 言語 | Ruby (3.4.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 305 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 13,184 KB |
| 最終ジャッジ日時 | 2024-12-23 16:47:50 |
| 合計ジャッジ時間 | 5,061 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | RE * 15 |
コンパイルメッセージ
Syntax OK
ソースコード
def check?(ans,n)
return false unless ans.size==n
return false if ans.any?{|v|v<1}
sum=ans.inject(:+)
return false unless sum%3==1
prod=ans.inject(:*)
return false unless prod%3==0
sum<=312456
end
n=gets.to_i
ans=[]
loop{
n.times{ans << rand(100)+1}
break if check(ans,n)
}
puts ans*" "
urutom