結果

問題 No.2247 01 ZigZag
ユーザー maguroflymagurofly
提出日時 2023-03-17 21:47:23
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 455 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-09-18 10:37:20
合計ジャッジ時間 5,615 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 48 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:9: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:14: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

N, M, K = gets.split.map(&:to_i)

min_sep, max_sep = [N, M].minmax
sep = min_sep + [min_sep + 1, max_sep].min

C = K + 1

if sep < C
    puts -1
    exit
end

if C == 1 and N > 0 and M > 0
    puts -1
    exit
end

if C.even?
    puts "0" * (N - (C / 2 - 1)) + "10" * (C / 2 - 1) + "1" * (M - (C / 2 - 1))
elsif N == C / 2
    puts "10" * (C / 2) + "1" * (M - C / 2)
else
    puts "0" * (N - C / 2) + "10" * (C / 2 - 1) + "1" * (M - (C / 2 - 1)) + "0"
end
0