0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paiza.ioでelixir その349

Posted at

概要

paiza.ioでelixirやってみた。
atcoder、見つけたので、やってみた。

参考にしたページ

練習問題

ABC 085 B - Kagami Mochi
N枚の整数値が与えられ、それらの重複しない要素の数を数える問題です。

投入するソース

4
10
8
8
6

期待値

3

サンプルコード

defmodule Main do
	def main do
		n = IO.gets("") 
		    |> String.trim() 
		    |> String.to_integer
		d = 1..n 
		    |> Enum.map(fn _ ->
		        IO.gets("") 
		        |> String.trim() 
		        |> String.to_integer 
		    end)
		d 
		|> Enum.uniq 
		|> length 
		|> IO.puts
	end
end

実行結果

3

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?