본문 바로가기

Programming/Solutions

(52)
[BAEKJOON] 9020번 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import java.util.Arrays;import java.util.Scanner; public class Main { public static void main(String[] args) { run(); } public static void run() { int t; int[] n; Scanner scanner = new Scanner(System.in); int a = -1, b = -1; t = scanner.nextInt(); n = new int[t]; for(int i = 0; i
[BAEKJOON] 4948번 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647#include #include int main(){ int input; int count = 0; int i, j; int* result = (int*)malloc(sizeof(int)); int idx = 0; int isComp[246913] = { 0 }; for (i = 2; i
[Project Euler] Problem 021 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 public class Problem021 { public static void main(String[] args) { System.out.println(run()); } public static String run() { int sum = 0; int b = 0; for(int a = 2; a
[Project Euler] Problem 020 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970public class Problem020 { public static void main(String[] args) { long beginTime = System.nanoTime(); System.out.println(run()); long endTime = System.nanoTime(); System.out.println("Running time: " + (endTime - beginTime) +"ns"); } public static String run() { int[..
[BAEKJOON] 1929번 1234567891011121314151617181920212223242526272829303132333435363738394041import java.util.Scanner; public class Main { private final static int SIZE = 1000000; public static void main(String[] args) { run(); } public static void run() { boolean[] isComp = new boolean[SIZE]; int i, j; Scanner sc = new Scanner(System.in); isComp[0] = isComp[1] = true; for (i = 2; i
[BAEKJOON] 1475번 1234567891011121314151617181920212223242526272829303132333435363738#include int run(); int main(){ return run();} int run(){ int n; int temp; int i; int max = 0; int arr[9] = { 0 }; scanf("%d", &n); do { temp = n % 10; n /= 10; if (temp == 9) { ++(arr[6]); } else { ++(arr[temp]); } } while (n); arr[6] = (arr[6] / 2) + (arr[6] % 2); for (i = 0; i
[Project Euler] Problem 019 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 public class Problem019 { public static void main(String[] args) { System.out.println(run()); } public static String run() { int sunday; int count = 0; int today = 1; for(int month = 1; month
[Project Euler] Problem 018 12345678910111213141516171819202122232425262728293031323334public class Problem018 { public static void main(String[] args) { System.out.println(run()); } public static String run() { int[][] arr = { {75}, {95, 64}, {17, 47, 82}, {18, 35, 87, 10}, {20, 4, 82, 47, 65}, {19, 1, 23, 75, 3, 34}, {88, 2, 77, 73, 7, 63, 67}, {99, 65, 4, 28, 6, 16, 70, 92}, {41, 41, 26, 56, 83, 40, 80, 70, 33}, {41, 48..