結果
| 問題 | 
                            No.796 well known
                             | 
                    
| コンテスト | |
| ユーザー | 
                             urutom
                         | 
                    
| 提出日時 | 2019-04-04 01:05:57 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 306 bytes | 
| コンパイル時間 | 132 ms | 
| コンパイル使用メモリ | 7,296 KB | 
| 実行使用メモリ | 133,216 KB | 
| 最終ジャッジ日時 | 2024-12-23 16:49:52 | 
| 合計ジャッジ時間 | 48,458 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 1 TLE * 14 | 
コンパイルメッセージ
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