結果

問題 No.796 well known
ユーザー urutomurutom
提出日時 2019-04-04 01:06:45
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 315 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 140,248 KB
最終ジャッジ日時 2023-08-25 04:42:51
合計ジャッジ時間 4,653 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
19,552 KB
testcase_01 AC 78 ms
15,292 KB
testcase_02 AC 76 ms
15,292 KB
testcase_03 AC 78 ms
15,156 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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)
  ans=[]
}
puts ans*" "
0