Skip to content

Commit

Permalink
Fix new line formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrey-xiao committed Apr 29, 2019
1 parent e9f0195 commit 76537de
Show file tree
Hide file tree
Showing 188 changed files with 279 additions and 279 deletions.
2 changes: 1 addition & 1 deletion src/codebook/algorithms/Nim.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static void main(String[] args) throws IOException {
break;
}
}
out.printf("The computer removes %d coins from pile %d\n", taken, pile);
out.printf("The computer removes %d coins from pile %d%n", taken, pile);

a[pile] -= taken;
sum -= taken;
Expand Down
2 changes: 1 addition & 1 deletion src/codebook/algorithms/StableMarriage.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void main(String[] args) throws IOException {
}
}
for (int i = 0; i < n; i++)
out.printf("Woman %d gets married with man %d\n", i, womenChoice[i]);
out.printf("Woman %d gets married with man %d%n", i, womenChoice[i]);
out.close();
}

Expand Down
2 changes: 1 addition & 1 deletion src/codebook/geometry/ConvexHull.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void main(String[] args) throws IOException {
l.addAll(u);

for (Point p : l)
out.printf("(%d, %d)\n", p.x, p.y);
out.printf("(%d, %d)%n", p.x, p.y);

out.println();
out.close();
Expand Down
4 changes: 2 additions & 2 deletions src/codebook/graph/BronKerbosch.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static void main(String[] args) throws IOException {
for (int i = 0; i < n; i++)
w[i] = readInt();

out.printf("Unweighted maximal clique: %d\n", solveUnweighted(n));
out.printf("Weighted maximal clique: %d\n", solveWeighted(n));
out.printf("Unweighted maximal clique: %d%n", solveUnweighted(n));
out.printf("Weighted maximal clique: %d%n", solveWeighted(n));
out.close();
}

Expand Down
8 changes: 4 additions & 4 deletions src/codebook/graph/DfsBiconnectedComponents.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public static void main(String[] args) throws IOException {
out.printf("%d-%d ", s.peek().a + 1, s.peek().b + 1);
s.pop();
}
out.printf("%d-%d\n", s.peek().a + 1, s.peek().b + 1);
out.printf("%d-%d%n", s.peek().a + 1, s.peek().b + 1);
s.pop();
for (int i = 0; i < n; i++)
if (cutVertex[i])
out.printf("%d is a cut vertex\n", i + 1);
out.printf("%d is a cut vertex%n", i + 1);
for (Edge e : bridges)
out.printf("%d-%d is a bridge\n", e.a, e.b);
out.printf("%d-%d is a bridge%n", e.a, e.b);
out.close();
}

Expand All @@ -82,7 +82,7 @@ static void dfs(int i, int prev) {
out.printf("%d-%d ", s.peek().a + 1, s.peek().b + 1);
s.pop();
}
out.printf("%d-%d\n", s.peek().a + 1, s.peek().b + 1);
out.printf("%d-%d%n", s.peek().a + 1, s.peek().b + 1);
s.pop();
}
if (low[j] > disc[i])
Expand Down
2 changes: 1 addition & 1 deletion src/codebook/graph/SccKosaraju.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static void main(String[] args) throws IOException {
}
}
for (int i = 0; i < n; i++)
out.printf("vertex %d is in component %d\n", i + 1, id[i]);
out.printf("vertex %d is in component %d%n", i + 1, id[i]);
out.close();
}

Expand Down
2 changes: 1 addition & 1 deletion src/codebook/graph/SccTarjan.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void main(String[] args) throws IOException {
if (disc[i] == 0)
dfs(i);
for (int i = 0; i < n; i++)
out.printf("Vertex %d is in component %d\n", i + 1, id[i]);
out.printf("Vertex %d is in component %d%n", i + 1, id[i]);
out.close();
}

Expand Down
4 changes: 2 additions & 2 deletions src/codebook/graph/mst/MinArborescence.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void main(String[] args) throws IOException {
edgesAdded++;
}
if (edgesAdded < sz - 1) {
out.printf("NO MINIMUM ARBORESCENCE FOUND\n");
out.printf("NO MINIMUM ARBORESCENCE FOUND%n");
return;
}
v = new boolean[n];
Expand Down Expand Up @@ -96,7 +96,7 @@ public static void main(String[] args) throws IOException {
}
}
}
out.printf("The minimum arborescence is %d\n", res);
out.printf("The minimum arborescence is %d%n", res);
out.close();
}

Expand Down
2 changes: 1 addition & 1 deletion src/codebook/string/SuffixTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void printTree(Node curr, int depth) {
if (curr.child[i] != null) {
for (int j = 0; j < depth; j++)
System.out.print("----");
System.out.printf("%s\n", input.substring(curr.child[i].start, curr.child[i].end == END ? input.length() : curr.child[i].end));
System.out.printf("%s%n", input.substring(curr.child[i].start, curr.child[i].end == END ? input.length() : curr.child[i].end));
printTree(curr.child[i], depth + 1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_MVP.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void main(String[] args) throws IOException {
while (!moves.isEmpty()) {
Point curr = moves.poll();
if (curr.x == ex && curr.y == ey) {
System.out.printf("pwned you in %d seconds eZ, learn to play n00b\n", curr.time);
System.out.printf("pwned you in %d seconds eZ, learn to play n00b%n", curr.time);
continue main;
}
for (int z = 0; z < 4; z++) {
Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_NAQ_2016_K.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void main(String[] args) throws IOException {
}

if (solutions == 1) {
out.printf("%d %d\n", ansx, ansy);
out.printf("%d %d%n", ansx, ansy);
} else {
out.println("?");
}
Expand Down
4 changes: 2 additions & 2 deletions src/contest/acm/ACM_NA_East_Central_2015_H.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ else if (inter3.x < inter1.x || inter2.x > inter1.x)
else if (x + r > w || x - r < 0 || Math.atan2(cueDir.y, cueDir.x) * 180 / Math.PI + 180 > 180)
out.println("impossible");
else
out.printf("%.2f %.2f\n", x, Math.atan2(cueDir.y, cueDir.x) * 180 / Math.PI + 180);
out.printf("%.2f %.2f%n", x, Math.atan2(cueDir.y, cueDir.x) * 180 / Math.PI + 180);

out.close();
}
Expand Down Expand Up @@ -160,4 +160,4 @@ public String toString() {
return String.format("(%f, %f)", x, y);
}
}
}
}
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_NEERC_2014_B.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static void main(String[] args) throws IOException {
out.println("Yes");

for (int i = 0; i < K; i++)
out.printf("%d %d\n", C1[i], C2[i]);
out.printf("%d %d%n", C1[i], C2[i]);

out.close();
}
Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_NEERC_2014_D.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static void main(String[] args) throws IOException {
for (; j < poss.size(); j++)
used.add(poss.get(j).index);

out.printf("%d %d\n", used.size(), lowVoltage);
out.printf("%d %d%n", used.size(), lowVoltage);
for (int index : used)
out.print(index + 1 + " ");
out.println();
Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_NEERC_2014_K.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static void compute(ArrayList<Integer> p) {
curr.add(x);
for (int i = 1; i < N; i++)
if (curr.contains(minDist[p.get(0)][i])) {
out.printf("%d %d\n", p.get(0) + 1, minDist[p.get(0)][i] + 1);
out.printf("%d %d%n", p.get(0) + 1, minDist[p.get(0)][i] + 1);
a.add(p.get(0));
b.add(minDist[p.get(0)][i]);
for (int x : p) {
Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_NEERC_2014_M.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args) throws IOException {
s.get(s.size() - 1).put(line[j], new Variable(i + 1, j + 1));
for (int k = s.size() - 2; k >= 0; k--) {
if (s.get(k).containsKey(line[j])) {
out.printf("%d:%d: warning: shadowed declaration of %c, the shadowed position is %d:%d\n", i + 1, j + 1, line[j], s.get(k).get(line[j]).line, s.get(k).get(line[j]).col);
out.printf("%d:%d: warning: shadowed declaration of %c, the shadowed position is %d:%d%n", i + 1, j + 1, line[j], s.get(k).get(line[j]).line, s.get(k).get(line[j]).col);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/contest/acm/ACM_Waterloo_Local_2017_Spring_A.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public static void main(String[] args) throws IOException {
}

if ((isA && solve(initial) + score > 0) || (!isA && solve(initial) + score < 0)) {
out.printf("Game %d: A wins.\n", i + 1);
out.printf("Game %d: A wins.%n", i + 1);
} else {
out.printf("Game %d: B wins.\n", i + 1);
out.printf("Game %d: B wins.%n", i + 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_Waterloo_Local_2017_Spring_C.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void main(String[] args) throws IOException {
}

permute(0);
out.printf("%.3f\n", ans);
out.printf("%.3f%n", ans);
}

out.close();
Expand Down
2 changes: 1 addition & 1 deletion src/contest/acm/ACM_Waterloo_Local_2017_Spring_E.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args) throws IOException {
boolean dup = false;
for (Map.Entry<String, Integer> e : occ.entrySet()) {
if (e.getValue() > 1) {
out.printf("%s-%s %d\n", e.getKey().substring(0, 3), e.getKey().substring(3), e.getValue());
out.printf("%s-%s %d%n", e.getKey().substring(0, 3), e.getKey().substring(3), e.getValue());
dup = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/contest/acm/CCPC_2017_D.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static void main(String[] args) throws IOException {
int B = readInt();

if (B >= A) {
out.printf("Dr. Chaz will have %d piece%s of chicken left over!\n", B - A, (B - A) == 1 ? "" : "s");
out.printf("Dr. Chaz will have %d piece%s of chicken left over!%n", B - A, (B - A) == 1 ? "" : "s");
} else {
out.printf("Dr. Chaz needs %d more piece%s of chicken!\n", A - B, (A - B) == 1 ? "" : "s");
out.printf("Dr. Chaz needs %d more piece%s of chicken!%n", A - B, (A - B) == 1 ? "" : "s");
}

out.close();
Expand Down
4 changes: 2 additions & 2 deletions src/contest/bloomberg/Bloomberg_Codecon_2017_B.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public static void main(String[] args) throws IOException {
}
}
if (winners.size() > 1)
out.printf("tie %d\n", score);
out.printf("tie %d%n", score);
else
out.printf("%d %d\n", winners.get(0) + 1, score);
out.printf("%d %d%n", winners.get(0) + 1, score);
out.close();
}

Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_1996_A.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ else if (x[0] > x[1])
s = "an abundant";
else
s = "a deficient";
System.out.printf("%d is %s number.\n", x[1], s);
System.out.printf("%d is %s number.%n", x[1], s);
}
}
}
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_1996_Stage_2_Hoppers.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void main(String[] args) throws IOException {
continue;

if (x == endx && endy == y) {
System.out.printf("Optimal solution takes %d hop(s).\n", moves);
System.out.printf("Optimal solution takes %d hop(s).%n", moves);
continue main;
}

Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_1996_Stage_2_Quadtrees.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void main(String[] args) throws IOException {
Quadtree qt = new Quadtree();
qt.insert(0, new StringBuilder(next()));
qt.insert(0, new StringBuilder(next()));
System.out.printf("There are %d black pixels.\n", qt.getTotalValue(1024));
System.out.printf("There are %d black pixels.%n", qt.getTotalValue(1024));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_1996_Stage_2_Train_Swapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void main(String[] args) {
}
}
}
System.out.printf("Optimal train swapping takes %d swap(s).\n", passes);
System.out.printf("Optimal train swapping takes %d swap(s).%n", passes);
}
}
}
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_1997_A.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void main(String[] args) throws IOException {
for (int x = 0; x < n; x++)
for (int y = 0; y < v; y++)
for (int z = 0; z < o; z++)
System.out.printf("%s %s %s.\n", nouns[x], verbs[y], objects[z]);
System.out.printf("%s %s %s.%n", nouns[x], verbs[y], objects[z]);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/contest/ccc/CCC_1997_C.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ public static void main(String[] args) {
int c = 0;
int round = 0;
while (b != 1 || a != 1) {
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated\n", round, a, b, c);
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated%n", round, a, b, c);
c += b / 2;
b = (int)Math.ceil(b / 2.0);
b += a / 2;
a = (int)Math.ceil(a / 2.0);
round++;
}
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated\n", round, a, b, c);
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated%n", round, a, b, c);
a -= 1;
b += 1;
round++;
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated\n", round, a, b, c);
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated%n", round, a, b, c);
b -= 1;
c += 1;
round++;
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated\n", round, a, b, c);
System.out.printf("Round %d: %d undefeated, %d one-loss, %d eliminated%n", round, a, b, c);
System.out.println("There are " + (round) + " rounds.");
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/contest/ccc/CCC_1999_P4.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public static void main(String[] args) throws IOException {
}
}
if (win)
System.out.printf("Win in %d knight move(s).\n", winMoves);
System.out.printf("Win in %d knight move(s).%n", winMoves);
else if (stale)
System.out.printf("Stalemate in %d knight move(s).\n", staleMoves);
System.out.printf("Stalemate in %d knight move(s).%n", staleMoves);
else
System.out.printf("Loss in %d knight move(s).\n", pr - 1);
System.out.printf("Loss in %d knight move(s).%n", pr - 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_1999_Stage_2_Cant_Get_There.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void main(String[] args) throws IOException {
double b = y - m * x;
if (ey == m * ex + b && (((dir == 0 || dir == 1) && ey >= y) || (dir == 2 || dir == 3) && ey <= y)) {
count += Math.abs(ey - prevy);
System.out.printf("B can be reached from A after %d move(s).\n", count);
System.out.printf("B can be reached from A after %d move(s).%n", count);
break;
}
if (dir == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_2000_J5_S3.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static void main(String[] args) throws IOException {
String s1 = readLine();
String s2 = readLine();
while (!s1.equals("The End")) {
System.out.printf("%s surf from %s to %s.\n", bfs(rm.get(s1), rm.get(s2)) ? "Can" : "Can't", s1, s2);
System.out.printf("%s surf from %s to %s.%n", bfs(rm.get(s1), rm.get(s2)) ? "Can" : "Can't", s1, s2);
s1 = readLine();
if (br.ready())
s2 = readLine();
Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_2000_S5.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args) throws IOException {
}
for (int x = 0; x < n; x++) {
if (segments[x].lo <= segments[x].hi)
System.out.printf("The sheep at (%.2f, %.2f) might be eaten.\n", points[x].x, points[x].y);
System.out.printf("The sheep at (%.2f, %.2f) might be eaten.%n", points[x].x, points[x].y);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_2001_Stage_2_Fast_Food.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) throws IOException {
}
}
for (int x = 0; x < n; x++) {
System.out.printf("Restaurant at %s serves %.1f%s of the population.\n", p[x], count[x] / 100.0d, "%");
System.out.printf("Restaurant at %s serves %.1f%s of the population.%n", p[x], count[x] / 100.0d, "%");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/contest/ccc/CCC_2002_J3_S1.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void main(String[] args) throws IOException {
for (int z = 0; z <= total / cost3; z++) {
for (int i = 0; i <= total / cost4; i++) {
if (x * cost1 + y * cost2 + z * cost3 + i * cost4 == total) {
System.out.printf("# of PINK is %d # of GREEN is %d # of RED is %d # of ORANGE is %d\n", x, y, z, i);
System.out.printf("# of PINK is %d # of GREEN is %d # of RED is %d # of ORANGE is %d%n", x, y, z, i);
count++;
if (x + y + z + i < min)
min = x + y + z + i;
Expand All @@ -32,8 +32,8 @@ public static void main(String[] args) throws IOException {
}
}
}
System.out.printf("Total combinations is %d.\n", count);
System.out.printf("Minimum number of tickets to print is %d.\n", min);
System.out.printf("Total combinations is %d.%n", count);
System.out.printf("Minimum number of tickets to print is %d.%n", min);
}

static String next() throws IOException {
Expand Down
2 changes: 1 addition & 1 deletion src/contest/ccc/CCC_2002_Stage_2_Connect_The_Campus.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args) throws IOException {
matrix[a][b] = 0;
matrix[b][a] = 0;
}
System.out.printf("%.2f\n", prim());
System.out.printf("%.2f%n", prim());
for (Connection c : conn) {
System.out.println(c.source + 1 + " " + (c.dest + 1));
}
Expand Down
Loading

0 comments on commit 76537de

Please sign in to comment.