File tree Expand file tree Collapse file tree 2 files changed +31
-26
lines changed
dynamic_programming/silver/silver_5 Expand file tree Collapse file tree 2 files changed +31
-26
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ package greedy .silver .silver_5 ;
2+
3+ import java .io .*;
4+ import java .util .StringTokenizer ;
5+
6+ public class _25644 {
7+
8+ public static void main (String [] args ) throws IOException {
9+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
10+ BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (System .out ));
11+ StringTokenizer st ;
12+
13+ int n = Integer .parseInt (br .readLine ());
14+
15+ int [] arr = new int [n ];
16+ int min = Integer .MAX_VALUE ;
17+ int max = 0 ;
18+
19+ st = new StringTokenizer (br .readLine ());
20+ for (int i = 0 ; i < n ; i ++) {
21+ arr [i ] = Integer .parseInt (st .nextToken ());
22+ min = Math .min (min , arr [i ]);
23+ max = Math .max (max , arr [i ] - min );
24+ }
25+
26+ bw .write (String .valueOf (max ));
27+ bw .flush ();
28+ bw .close ();
29+ }
30+
31+ }
You can’t perform that action at this time.
0 commit comments