結果

問題 No.232 めぐるはめぐる (2)
ユーザー 👑 obakyanobakyan
提出日時 2020-04-23 09:28:15
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 1,162 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 07:32:25
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 7 ms
5,248 KB
testcase_02 AC 8 ms
5,376 KB
testcase_03 AC 7 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 6 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 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
else
  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