Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PE #12
//Title of this code //'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_45 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { System.out.println("Hello, World!"); int divsnum = 0; int indBig = 0; int tempdivs = 0; int LIMIT = 1800; ArrayList<Integer> divs = new ArrayList<Integer>(); //triangle array creator //int[] tri = new int[LIMIT]; int sum = 0; for(int i=0; i<LIMIT; i++) { sum+=i; divs = getDiv(sum); tempdivs = divs.size(); if (tempdivs > divsnum) { divsnum = tempdivs; indBig = sum;} } System.out.println("divsnum: "+divsnum); System.out.println("indBig: "+indBig); System.out.println("sum: "+sum); } public static ArrayList<Integer> getDiv(int num) { ArrayList<Integer> divs = new ArrayList<Integer>(); for(int i=1; i<=num; i++) { if (num%i==0) { divs.add(i); } } return divs; } }
run
|
edit
|
history
|
help
0
Leetcode 297. Serialize and Deserialize Binary Tree
Java Object structure dumper (iterative)
InnerClass vs. Anonymous vs. Lambda...
Bound Types
Kadane's Algorithm
string reverse program without arry in java
Invert sign and add
2darray
WM Test
Problem: fb_series