# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
304972 | llaki | 비스킷 담기 (IOI20_biscuits) | Java | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
import java.io.PrintWriter;
public class grader {
public static void main(String[] args) {
InputReader inputReader = new InputReader(System.in);
int q = inputReader.readInt();
int[] k = new int[q];
long[] x = new long[q];
long[][] a = new long[q][];
for (int t = 0; t < q; t++) {
k[t] = inputReader.readInt();
x[t] = inputReader.readLong();
a[t] = new long[k[t]];
for (int i = 0; i < k[t]; i++) {
a[t][i] = inputReader.readLong();
}
}
inputReader.close();
long[] results = new long[q];
biscuits solver = new biscuits();
for (int t = 0; t < q; t++) {
results[t] = solver.count_tastiness(x[t], a[t]);
}
PrintWriter out = new PrintWriter(System.out);
for (int i = 0; i < q ; i++) {
out.println(results[i]);
}
out.flush();
out.close();
}
}
class InputReader implements java.io.Closeable {
private java.io.InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader(java.io.InputStream stream) {
this.stream = stream;
}
@Override
public void close() {
try {
this.stream.close();
} catch (java.io.IOException e) {
}
}
public int read() {
if (numChars == -1) {
throw new java.util.InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (java.io.IOException e) {
throw new java.util.InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int readInt() {
int c = eatWhite();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new java.util.InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public long readLong() {
int c = eatWhite();
long sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9') {
throw new java.util.InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public String readString() {
int c = eatWhite();
StringBuilder res = new StringBuilder();
do {
if (Character.isValidCodePoint(c))
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public String readLine() {
StringBuilder res = new StringBuilder();
while (true) {
int c = read();
if (c == '\n' || c == '\r' || c == -1)
break;
if (Character.isValidCodePoint(c))
res.appendCodePoint(c);
}
return res.toString();
}
private int eatWhite() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
return c;
}
public static boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}