git reimport
This commit is contained in:
74
archive/2019.03/2019.03.15 - Yandex.Interview/F.java
Normal file
74
archive/2019.03/2019.03.15 - Yandex.Interview/F.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package chelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class F extends ChelperSolution {
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
super.solve(testNumber, in, out);
|
||||
}
|
||||
|
||||
int rawReadInt() {
|
||||
try {
|
||||
int res = 0;
|
||||
|
||||
while (true) {
|
||||
char c = (char) System.in.read();
|
||||
|
||||
if ('0' <= c && c <= '9') {
|
||||
res = res * 10 + c - '0';
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
int maxDecimalPower(int x) {
|
||||
int d = 1;
|
||||
while (d * 10 <= x) {
|
||||
d *= 10;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
void rawPrintSpace(int x) {
|
||||
int d = maxDecimalPower(x);
|
||||
|
||||
while (d > 0) {
|
||||
System.out.write(x / d % 10 + '0');
|
||||
d /= 10;
|
||||
}
|
||||
System.out.write(' ');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int[] counts = new int[101];
|
||||
|
||||
int k = rawReadInt();
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < k; i++) {
|
||||
int m = rawReadInt();
|
||||
|
||||
for (int j = 0; j < m; j++) {
|
||||
counts[rawReadInt()]++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 101; i++) {
|
||||
for (int j = 0; j < counts[i]; j++) {
|
||||
rawPrintSpace(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user