public class Test { static int count = 0; public static void main(String[] args) { partition(200, 200); System.out.println(count); } public static void partition(int n, int max) { if (n == 0) { count++; return; } for (int i = Math.min(max, n); i >= 1; i--) { if (i == 200 || i == 100 || i == 50 || i == 20 || i == 10 || i == 5 || i == 2 || i == 1) partition(n - i, i); } } } 73682 Job Finished in 0.02 seconds정수론에서 나오는 자연수 분할 문제 ..
Euler Problem 31 ...
It's just a integer partition.
Euler 40 for Java: Finding the nth digit of the fractional part of the irrational number
Simply, the Integer array can be used to write digits.
public class Test { static int[] x = new int[1000000]; static int index = 0; public static void main(String[] args) { for (int i = 1; i < x.length; i++) { if(index >= x.length) break; append(i); } System.out.println(d(1) * d(10) * d(100) * d(1000) * d(10000) * d(100000) * d(1000000)); } private static int d(int i) { return x[i - 1]; } private static void append(int n) { String a = String.valueOf(n); for(int i = 0; i < a.length(); i++) { if(index >= x.length) break; x[index] = Integer.valueOf(String.valueOf(a.charAt(i))); index++; } } }
Subscribe to:
Posts (Atom)
-
Opening the black box of Deep Neural Networks via Information - https://arxiv.org/pdf/1703.00810.pdf 지금까지 딥 러닝은 어떻게 동작하는지 이해할 수 없다고 믿어져왔다...
-
음성 인공지능 분야에서 스타트업이 생각해볼 수 있는 전략은 아마 다음과 같이 3가지 정도가 있을 것이다: 독자적 Vertical 음성 인공지능 Application 구축 기 음성 플랫폼을 활용한 B2B2C 형태의 비지니스 구축 기 음성 플랫폼...
-
As mentioned ago, I've been forming up the Hamburg project with Hyunsik Choi. Let's see more detail in the diagram of computing met...