chore(java): adjust skeleton

* add comments marking the regions
* adjust runner to take care of SINGLE v. MULTIPLE test cases

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-07-23 20:45:21 +02:00
parent 02cbe139e9
commit f333cf115a
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -9,35 +9,34 @@ import java.util.Random;
import java.util.StringTokenizer;
public class A {
private FastScanner fs = new FastScanner();
private PrintWriter out = new PrintWriter(System.out);
void solve() {
// TODO
}
// region runner
private static final boolean SINGLE = false;
void run() {
solve();
if (SINGLE) {
solve();
} else {
int N = fs.nextInt();
for (int i = 0; i < N; ++i) {
solve();
}
}
out.close();
}
public static void main(String[] args) {
new A().run();
}
// endregion runner
// region math
static final Random random = new Random();
static final int mod = 1_000_000_007;
static void ruffleSort(int[] a) {
int n = a.length;// shuffle, then sort
for (int i = 0; i < n; i++) {
int oi = random.nextInt(n), temp = a[oi];
a[oi] = a[i];
a[i] = temp;
}
Arrays.sort(a);
}
static long add(long a, long b) {
return (a + b) % mod;
}
@ -74,6 +73,18 @@ public class A {
static long nCk(int n, int k) {
return mul(factorials[n], mul(invFactorials[k], invFactorials[n - k]));
}
// endregion math
// region sorts
static void ruffleSort(int[] a) {
int n = a.length;// shuffle, then sort
for (int i = 0; i < n; i++) {
int oi = random.nextInt(n), temp = a[oi];
a[oi] = a[i];
a[i] = temp;
}
Arrays.sort(a);
}
static void sort(int[] a) {
ArrayList<Integer> l = new ArrayList<>();
@ -83,7 +94,25 @@ public class A {
for (int i = 0; i < a.length; i++)
a[i] = l.get(i);
}
// endregion sorts
// region output
private PrintWriter out = new PrintWriter(System.out);
private void yes() {
out.println("YES");
}
private void no() {
out.println("NO");
}
private void yesno(boolean ans) {
out.println(ans ? "YES" : "NO");
}
// endregion output
// region input
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
@ -113,5 +142,7 @@ public class A {
return Long.parseLong(next());
}
}
private FastScanner fs = new FastScanner();
// endregion input
}