0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby二列からの入力4種

Posted at

N M
a1 b1
a2 b2
... ...
an bn

ruby
N, M, *rest = $stdin.read.split
ABS = rest.each_slice(2).to_a

参考
https://yhara.jp/CompetitiveProgrammingInRuby

N T

c1 t1

c2 t2

:

cN tN

readlinesの場合

ruby
N, T = gets.split.map(&:to_i)
CTs = readlines.map{|l| l.split.map(&:to_i)}

参考
https://beta.atcoder.jp/contests/abc112/submissions/3415903

ruby
z,*a=$<.map{|s|s.split.map &:to_i}

参考
https://beta.atcoder.jp/contests/abc112/submissions/3353574

ruby
n,T=gets.split.map &:to_i;

さっぱりわかりません。

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?