Close BufferedReader
This commit is contained in:
parent
25f432f7e1
commit
19675c7f6e
|
@ -26,6 +26,8 @@ public class billboard {
|
||||||
int y5 = Integer.parseInt(st.nextToken());
|
int y5 = Integer.parseInt(st.nextToken());
|
||||||
int x6 = Integer.parseInt(st.nextToken());
|
int x6 = Integer.parseInt(st.nextToken());
|
||||||
int y6 = Integer.parseInt(st.nextToken());
|
int y6 = Integer.parseInt(st.nextToken());
|
||||||
|
|
||||||
|
br.close();
|
||||||
|
|
||||||
// the visible area is the sum of the visible area of the first billboard and the second billboard
|
// the visible area is the sum of the visible area of the first billboard and the second billboard
|
||||||
int combinedArea = visibleArea(x1, y1, x2, y2, x5, y5, x6, y6) + visibleArea(x3, y3, x4, y4, x5, y5, x6, y6);
|
int combinedArea = visibleArea(x1, y1, x2, y2, x5, y5, x6, y6) + visibleArea(x3, y3, x4, y4, x5, y5, x6, y6);
|
||||||
|
|
|
@ -17,6 +17,8 @@ public class measurement {
|
||||||
cow[i] = st.nextToken();
|
cow[i] = st.nextToken();
|
||||||
change[i] = Integer.parseInt(st.nextToken());
|
change[i] = Integer.parseInt(st.nextToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
br.close();
|
||||||
|
|
||||||
// the milk variables track the amount of milk that each cows was last known to produce
|
// the milk variables track the amount of milk that each cows was last known to produce
|
||||||
int bessieMilk = 7, elsieMilk = 7, mildredMilk = 7;
|
int bessieMilk = 7, elsieMilk = 7, mildredMilk = 7;
|
||||||
|
@ -41,7 +43,7 @@ public class measurement {
|
||||||
}
|
}
|
||||||
// compute the highest milk total and see which cows produced the most milk
|
// compute the highest milk total and see which cows produced the most milk
|
||||||
int highestMilk = Math.max(bessieMilk, Math.max(elsieMilk, mildredMilk));
|
int highestMilk = Math.max(bessieMilk, Math.max(elsieMilk, mildredMilk));
|
||||||
boolean bessieOnNext = bessieMilk == highestMilk;
|
boolean bessieOnNext = (bessieMilk == highestMilk);
|
||||||
boolean elsieOnNext = elsieMilk == highestMilk;
|
boolean elsieOnNext = elsieMilk == highestMilk;
|
||||||
boolean mildredOnNext = mildredMilk == highestMilk;
|
boolean mildredOnNext = mildredMilk == highestMilk;
|
||||||
if(bessieOn != bessieOnNext || elsieOn != elsieOnNext || mildredOn != mildredOnNext) {
|
if(bessieOn != bessieOnNext || elsieOn != elsieOnNext || mildredOn != mildredOnNext) {
|
||||||
|
|
|
@ -27,6 +27,8 @@ public class shuffle {
|
||||||
for(int i = 1; i <= n; i++) {
|
for(int i = 1; i <= n; i++) {
|
||||||
finalLocs[i] = Integer.parseInt(st.nextToken());
|
finalLocs[i] = Integer.parseInt(st.nextToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
br.close();
|
||||||
|
|
||||||
// allocate an array to store the original locations of all cows
|
// allocate an array to store the original locations of all cows
|
||||||
int[] originalLocations = new int[n+1];
|
int[] originalLocations = new int[n+1];
|
||||||
|
|
Reference in a new issue