Birthday Cake Candles

Run Settings
LanguageJava
Language Version
Run Command
import java.util.Scanner; import static java.lang.System.*; import java.util.ArrayList; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(in); int n = scan.nextInt(); int m = 0; int c = 0; ArrayList<Integer> cs = new ArrayList<>(); for (int i = 0; i < n; ++i) { c = scan.nextInt(); if (c > m) m = c; cs.add(c); } c = 0; for (int i = 0; i < n; ++i) if (cs.get(i) == m) ++c; out.println(c); } }
Editor Settings
Theme
Key bindings
Full width
Lines