結果

問題 No.1543 [Cherry 2nd Tune A] これがプログラミングなのね
ユーザー DieGoDieGo
提出日時 2021-07-22 12:11:40
言語 Elixir
(1.16.2)
結果
RE  
実行時間 -
コード長 450 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 63,048 KB
実行使用メモリ 58,556 KB
最終ジャッジ日時 2024-07-17 14:39:21
合計ジャッジ時間 22,593 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
    warning: missing parentheses for expression following "do:" keyword. Parentheses are required to solve ambiguity inside keywords.

    This error happens when you have function calls without parentheses inside keywords. For example:

        function(arg, one: nested_call a, b, c)
        function(arg, one: if expr, do: :this, else: :that)

    In the examples above, we don't know if the arguments "b" and "c" apply to the function "function" or "nested_call". Or if the keywords "do" and "else" apply to the function "function" or "if". You can solve this by explicitly adding parentheses:

        function(arg, one: if(expr, do: :this, else: :that))
        function(arg, one: nested_call(a, b, c))

    Ambiguity found at:
    │
  7 │       String.equivalent?(c, "<") -> if si < ti, do: IO.puts "YES", else: IO.puts "NO"
    │       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ Main.exs:7

    warning: missing parentheses for expression following "do:" keyword. Parentheses are required to solve ambiguity inside keywords.

    This error happens when you have function calls without parentheses inside keywords. For example:

        function(arg, one: nested_call a, b, c)
        function(arg, one: if expr, do: :this, else: :that)

    In the examples above, we don't know if the arguments "b" and "c" apply to the function "function" or "nested_call". Or if the keywords "do" and "else" apply to the function "function" or "if". You can solve this by explicitly adding parentheses:

        function(arg, one: if(expr, do: :this, else: :that))
        function(arg, one: nested_call(a, b, c))

    Ambiguity found at:
    │
  8 │       String.equivalent?(c, ">") -> if si > ti, do: IO.puts "YES", else: IO.puts "NO"
    │       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ Main.exs:8

    warning: missing parentheses for expression following "do:" keyword. Paren

ソースコード

diff #

defmodule Main do
  def main do
    [s, t, c] = IO.read(:line) |> String.trim() |> String.split(" ");
    si = String.to_integer(s); ti = String.to_integer(t);

    cond do
      String.equivalent?(c, "<") -> if si < ti, do: IO.puts "YES", else: IO.puts "NO"
      String.equivalent?(c, ">") -> if si > ti, do: IO.puts "YES", else: IO.puts "NO"
      String.equivalent?(c, "=") -> if si == ti, do: IO.puts "YES", else: IO.puts "NO"
    end
  end
end
0