結果
問題 |
No.8024 等式
|
ユーザー |
|
提出日時 | 2017-04-22 23:29:25 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 387 bytes |
コンパイル時間 | 98 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 13,888 KB |
最終ジャッジ日時 | 2024-07-21 16:34:22 |
合計ジャッジ時間 | 9,982 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 TLE * 1 |
コンパイルメッセージ
Main.rb:19: warning: assigned but unused variable - n Syntax OK
ソースコード
#!/usr/bin/ruby def dfs(a,&block) return to_enum(:dfs,a) if !block_given? yield a[0] if a.size<2 (a.size-1).times{|i| dfs(a[0..i]){|l| dfs(a[i+1..-1]){|r| (puts :YES;exit) if l==r next if l<r yield l+r yield l-r yield l*r yield Rational(l,r) } } } end n,*a=`dd`.split.map(&:to_i) a.permutation{|b| next if b[0]>b[-1] dfs(b).each{|e| } } puts :NO