結果
| 問題 | No.638 Sum of "not power of 2" | 
| コンテスト | |
| ユーザー |  horiesiniti | 
| 提出日時 | 2018-03-13 07:51:47 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 85 ms / 1,000 ms | 
| コード長 | 208 bytes | 
| コンパイル時間 | 184 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-11-17 15:36:25 | 
| 合計ジャッジ時間 | 2,101 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 | 
コンパイルメッセージ
Main.rb:24: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
def f(n) c1=0 while n>0 if n%2==1 c1+=1 end n=n/2 end return c1 end n=gets.to_i m=3 ok=false while n-m>=m if f(n-m)>1 && f(m)>1 ok=true break end m+=1 end if ok puts [m,n-m]*" " else puts -1 end
