回答編集履歴

1

訂正

2017/03/26 05:40

投稿

退会済みユーザー
test CHANGED
@@ -75,3 +75,107 @@
75
75
  }
76
76
 
77
77
  ```
78
+
79
+
80
+
81
+ 重複する時結果が違うようなので訂正しました 以下でできると思います
82
+
83
+
84
+
85
+ ```java
86
+
87
+ import java.util.*;
88
+
89
+ class AP12{
90
+
91
+
92
+
93
+ public static void main(String[] args){
94
+
95
+
96
+
97
+ int [][] n = {{1,4,6,10,11,12},{2,5,8},{3,9,12},{7}};
98
+
99
+
100
+
101
+ meth(n);
102
+
103
+
104
+
105
+ }
106
+
107
+
108
+
109
+ static void meth(int[][] a){
110
+
111
+
112
+
113
+ ArrayList<Integer> b=new ArrayList<>();
114
+
115
+
116
+
117
+ for(int i=0;i<a.length;i++){
118
+
119
+ for(int n=0;n<a[i].length;n++){
120
+
121
+
122
+
123
+ b.add(a[i][n]);
124
+
125
+
126
+
127
+ }
128
+
129
+ }
130
+
131
+
132
+
133
+ Collections.sort(b);
134
+
135
+
136
+
137
+ boolean v=true;
138
+
139
+
140
+
141
+ for(int p=0;p<12;p++){
142
+
143
+
144
+
145
+
146
+
147
+ if(!(b.get(p).equals((p+1)))){
148
+
149
+ v=false;
150
+
151
+ break;
152
+
153
+ }
154
+
155
+ }
156
+
157
+
158
+
159
+ if(v){
160
+
161
+ System.out.println("contains");
162
+
163
+ }else{
164
+
165
+ System.out.println("don't contains");
166
+
167
+
168
+
169
+ }
170
+
171
+
172
+
173
+ }
174
+
175
+
176
+
177
+ }
178
+
179
+ ```
180
+
181
+