回答編集履歴
9
修正
test
CHANGED
@@ -98,7 +98,7 @@
|
|
98
98
|
|
99
99
|
```
|
100
100
|
|
101
|
-
katoy様の方法を参考にさせていただきました。
|
101
|
+
otn様とkatoy様の方法を参考にさせていただきました。
|
102
102
|
|
103
103
|
```Ruby
|
104
104
|
|
8
修正
test
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
p $stdin.map { |e| e.split(' ')
|
109
|
+
p $stdin.map { |e| e.split(' ') }.drop(ARGV[0].to_i - 1)
|
110
110
|
|
111
111
|
|
112
112
|
|
7
修正
test
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
p $stdin.map { |e| e.split(' ').map(&:to_
|
109
|
+
p $stdin.map { |e| e.split(' ').map(&:to_f) }.drop(ARGV[0].to_i - 1)
|
110
110
|
|
111
111
|
|
112
112
|
|
6
修正
test
CHANGED
@@ -106,7 +106,7 @@
|
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
p $stdin.map { |
|
109
|
+
p $stdin.map { |e| e.split(' ').map(&:to_i) }.drop(ARGV[0].to_i - 1)
|
110
110
|
|
111
111
|
|
112
112
|
|
5
修正
test
CHANGED
@@ -97,3 +97,17 @@
|
|
97
97
|
[["255", "423", "56", "9988"], ["266", "432", "50", "6542"]]
|
98
98
|
|
99
99
|
```
|
100
|
+
|
101
|
+
katoy様の方法を参考にさせていただきました。
|
102
|
+
|
103
|
+
```Ruby
|
104
|
+
|
105
|
+
# encoding: utf-8
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
p $stdin.map { |r| r.split(' ').map(&:to_i) }.drop(ARGV[0].to_i - 1)
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
```
|
4
修正
test
CHANGED
@@ -74,7 +74,7 @@
|
|
74
74
|
|
75
75
|
|
76
76
|
|
77
|
-
p array.drop(gets.to_i)
|
77
|
+
p array.drop(gets.to_i - 1)
|
78
78
|
|
79
79
|
```
|
80
80
|
|
3
修正
test
CHANGED
@@ -77,3 +77,23 @@
|
|
77
77
|
p array.drop(gets.to_i)
|
78
78
|
|
79
79
|
```
|
80
|
+
|
81
|
+
実行結果例
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
4 10 3
|
86
|
+
|
87
|
+
2 1.2 2 0.4
|
88
|
+
|
89
|
+
255 423 56 9988
|
90
|
+
|
91
|
+
266 432 50 6542
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
3
|
96
|
+
|
97
|
+
[["255", "423", "56", "9988"], ["266", "432", "50", "6542"]]
|
98
|
+
|
99
|
+
```
|
2
修正
test
CHANGED
@@ -25,3 +25,55 @@
|
|
25
25
|
```
|
26
26
|
|
27
27
|
考えてみました。
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
他の方法
|
32
|
+
|
33
|
+
```Ruby
|
34
|
+
|
35
|
+
# encoding: utf-8
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
array = []
|
40
|
+
|
41
|
+
array << gets.chomp.split("\s") until STDIN.eof
|
42
|
+
|
43
|
+
p array
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
参考にしたページ
|
48
|
+
|
49
|
+
[while修飾子/until修飾子/while文/until文 ― ちょっと便利な繰り返し処理の構文とは?(1)](http://www.buildinsider.net/language/rubytips/0009)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
表示する範囲を指定する場合
|
54
|
+
|
55
|
+
```Ruby
|
56
|
+
|
57
|
+
# encoding: utf-8
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
array = []
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
loop do
|
66
|
+
|
67
|
+
input = gets.chomp
|
68
|
+
|
69
|
+
break if input.empty?
|
70
|
+
|
71
|
+
array << input.split("\s")
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
p array.drop(gets.to_i)
|
78
|
+
|
79
|
+
```
|
1
修正
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
break if input.empty?
|
16
16
|
|
17
|
-
array << input.
|
17
|
+
array << input.split("\s")
|
18
18
|
|
19
19
|
end
|
20
20
|
|