結果

問題 No.232 めぐるはめぐる (2)
ユーザー 👑 obakyanobakyan
提出日時 2020-04-23 09:30:26
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 8 ms / 1,000 ms
コード長 1,179 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 5,156 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 13:51:36
合計ジャッジ時間 1,534 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,352 KB
testcase_01 AC 7 ms
4,348 KB
testcase_02 AC 8 ms
4,352 KB
testcase_03 AC 7 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 5 ms
4,352 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,352 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 1 ms
4,352 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 1 ms
4,352 KB
testcase_24 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local t, a, b = io.read("*n", "*n", "*n")
if t < a or t < b then
  print("NO")
  os.exit()
end
if t == 1 and a + b == 0 then
  print("NO")
  os.exit()
end
print("YES")
local c = math.min(a, b)
if 0 < c then
  for i = 1, c - 1 do
    print("^>")
  end
  t = t - c + 1
  a = a - c + 1
  b = b - c + 1
end
if t == 0 then
  os.exit()
end
if a == 1 and b == 1 then
  if t % 2 == 0 then
    print("^") print(">")
    t = t - 2
  else
    print("^>")
    t = t - 1
  end
  a, b = a - 1, b - 1
elseif 0 < a * b then
  print("^>")
  t = t - 1
  a = a - 1
  b = b - 1
end
if t == 0 then
  os.exit()
end
if a == 0 then
  if (t - b) % 2 == 1 then
    print("^>")
    print("v")
    b = b - 1
    t = t - 2
  end
  if b == -1 then
    print("<")
    t = t - 1
  else
    for i = 1, b do
      print(">")
    end
    t = t - b
  end
  local ht = t / 2
  for i = 1, ht do
    print(">") print("<")
  end
else
  if (t - a) % 2 == 1 then
    print("^>")
    print("<")
    a = a - 1
    t = t - 2
  end
  if a == -1 then
    print("v")
    t = t - 1
  else
    for i = 1, a do
      print("^")
    end
    t = t - a
  end
  local ht = t / 2
  for i = 1, ht do
    print(">") print("<")
  end
end
0