結果
| 問題 |
No.638 Sum of "not power of 2"
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-26 22:28:21 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 1,000 ms |
| コード長 | 200 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-12-30 02:18:25 |
| 合計ジャッジ時間 | 2,425 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
コンパイルメッセージ
Main.rb:3: warning: ambiguous first argument; put parentheses or a space even after `-' operator Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
x = gets.to_i
if x <= 5
p -1
else
if x == 7
p -1
exit
end
y = x - 3
if y.to_s(2).count(?1) == 1
puts "5 #{x - 5}"
else
puts "3 #{y}"
end
end