This repository was archived by the owner on Feb 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ 7 2
2+ 20
3+ 25
4+ 18
5+ 8
6+ 10
7+ 3
8+ 1
Original file line number Diff line number Diff line change 1+ 8
Original file line number Diff line number Diff line change 1+ import java .io .*;
2+ import java .util .*;
3+
4+ /*
5+ * Angry Cows: Silver Edition
6+ */
7+ public class angry {
8+ static List <Integer > field = new ArrayList <Integer >();
9+ //public List<Integer> launchSim(int pos){
10+ //
11+ //}
12+ public static void main (String [] args ) throws IOException {
13+ BufferedReader f = new BufferedReader (new FileReader ("angry.in" ));
14+ StringTokenizer st = new StringTokenizer (f .readLine ());
15+ int N = Integer .parseInt (st .nextToken ()); // Number of haybales
16+ int K = Integer .parseInt (st .nextToken ()); // Number of cows
17+ List <Integer > costs = new ArrayList <Integer >(N - 1 );
18+ for (int i = 0 ; i < N ; i ++) {
19+ field .add (Integer .parseInt (f .readLine ()));
20+ }
21+ f .close ();
22+ field .sort (null );
23+ for (int i = 0 ; i < (N -1 ); i ++) {
24+ costs .add (field .get (i +1 ) - field .get (i ));
25+ }
26+ System .out .println (field );
27+ System .out .println (costs );
28+ PrintWriter pw = new PrintWriter (new BufferedWriter (new FileWriter ("angry.out" )));
29+ pw .println (Collections .max (costs ));
30+ pw .close ();
31+ //System.out.println("");
32+ for (int i = 0 ; i < N ; i ++) {
33+
34+ }
35+ }
36+
37+ }
You can’t perform that action at this time.
0 commit comments