結果

問題 No.1543 [Cherry 2nd Tune A] これがプログラミングなのね
ユーザー DieGo
提出日時 2021-07-22 12:11:40
言語 Elixir
(1.18.1)
結果
RE  
実行時間 -
コード長 450 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 63,048 KB
実行使用メモリ 58,556 KB
最終ジャッジ日時 2024-07-17 14:39:21
合計ジャッジ時間 22,593 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 22 RE * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
    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