git reimport
This commit is contained in:
43
archive/2019.02/2019.02.24 - KickstartPrep/TaskA.java
Normal file
43
archive/2019.02/2019.02.24 - KickstartPrep/TaskA.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskA extends SimpleSavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int testCount = in.nextInt();
|
||||
|
||||
for (int test = 0; test < testCount; test++) {
|
||||
int a = in.nextInt();
|
||||
int b = in.nextInt();
|
||||
int n = in.nextInt();
|
||||
|
||||
while (true) {
|
||||
int m = (a + b + 1) / 2;
|
||||
|
||||
out.println(m);
|
||||
out.flush();
|
||||
|
||||
String resp = in.nextString();
|
||||
|
||||
if (resp.equals("CORRECT")) {
|
||||
break;
|
||||
} else if (resp.equals("TOO_BIG")) {
|
||||
b = m - 1;
|
||||
} else if (resp.equals("TOO_SMALL")) {
|
||||
a = m + 1;
|
||||
} else {
|
||||
System.out.println("WTF");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
archive/2019.02/2019.02.24 - KickstartPrep/TaskA.json
Normal file
33
archive/2019.02/2019.02.24 - KickstartPrep/TaskA.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name" : "TaskA",
|
||||
"testType" : "SINGLE",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "1\n12",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.TaskA",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.02.24",
|
||||
"contestName" : "KickstartPrep",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : true,
|
||||
"interactor" : "chelper.TaskAInteractor"
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package chelper;
|
||||
|
||||
import net.egork.chelper.tester.State;
|
||||
import net.egork.chelper.tester.Verdict;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
|
||||
public class TaskAInteractor {
|
||||
public Verdict interact(InputStream rawTestInput, InputStream rawIn, OutputStream rawOut, State<Boolean> state) {
|
||||
InputReader testIn = new InputReader(rawTestInput);
|
||||
InputReader in = new InputReader(rawIn);
|
||||
OutputWriter out = new OutputWriter(rawOut);
|
||||
|
||||
int testCount = testIn.nextInt();
|
||||
out.println(testCount);
|
||||
|
||||
int a = 0;
|
||||
int b = 1000;
|
||||
int n = 30;
|
||||
|
||||
for (int test = 1; test <= testCount; test++) {
|
||||
int x = testIn.nextInt();
|
||||
|
||||
out.println(a + " " + b);
|
||||
out.println(n);
|
||||
|
||||
for (int guessCount = 0; true; guessCount++) {
|
||||
if (guessCount >= n) {
|
||||
return Verdict.WA;
|
||||
}
|
||||
|
||||
int guess = in.nextInt();
|
||||
|
||||
if (guess == x) {
|
||||
out.println("CORRECT");
|
||||
break;
|
||||
}
|
||||
|
||||
if (guess < x) {
|
||||
out.println("TOO_SMALL");
|
||||
} else {
|
||||
out.println("TOO_BIG");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Verdict.OK;
|
||||
}
|
||||
}
|
44
archive/2019.02/2019.02.24 - KickstartPrep/TaskB.java
Normal file
44
archive/2019.02/2019.02.24 - KickstartPrep/TaskB.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskB extends SavingChelperSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
out.printf("Case #%d: ", testNumber);
|
||||
|
||||
int n = in.nextInt();
|
||||
|
||||
String s = in.nextString();
|
||||
|
||||
int[] a = new int[n];
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
a[i] = s.charAt(i) - '0';
|
||||
}
|
||||
|
||||
int k = (n + 1) / 2;
|
||||
|
||||
int sum = 0;
|
||||
|
||||
for (int i = 0; i < k; i++) {
|
||||
sum += a[i];
|
||||
}
|
||||
int max = sum;
|
||||
|
||||
for (int i = k; i < n; i++) {
|
||||
sum += a[i] - a[i - k];
|
||||
max = Math.max(max, sum);
|
||||
}
|
||||
|
||||
out.println(max);
|
||||
}
|
||||
}
|
34
archive/2019.02/2019.02.24 - KickstartPrep/TaskB.json
Normal file
34
archive/2019.02/2019.02.24 - KickstartPrep/TaskB.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name" : "TaskB",
|
||||
"testType" : "MULTI_NUMBER",
|
||||
"input" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "input.txt"
|
||||
},
|
||||
"output" : {
|
||||
"type" : "STANDARD",
|
||||
"fileName" : "output.txt"
|
||||
},
|
||||
"tests" : [ {
|
||||
"input" : "4\n4\n1332\n4\n9583\n3\n616\n10\n1029384756",
|
||||
"output" : "Case #1: 6\nCase #2: 14\nCase #3: 7\nCase #4: 31",
|
||||
"index" : 0,
|
||||
"active" : true
|
||||
} ],
|
||||
"location" : "src/chelper",
|
||||
"vmArgs" : "-Xmx256m -Xss64m",
|
||||
"mainClass" : "Main",
|
||||
"taskClass" : "chelper.TaskB",
|
||||
"checkerClass" : "net.egork.chelper.checkers.TokenChecker",
|
||||
"checkerParameters" : "",
|
||||
"testClasses" : [ ],
|
||||
"date" : "2019.02.24",
|
||||
"contestName" : "KickstartPrep",
|
||||
"truncate" : true,
|
||||
"inputClass" : "io.InputReader",
|
||||
"outputClass" : "io.OutputWriter",
|
||||
"includeLocale" : false,
|
||||
"failOnOverflow" : false,
|
||||
"interactive" : false,
|
||||
"interactor" : "net.egork.chelper.tester.Interactor"
|
||||
}
|
Reference in New Issue
Block a user