Programming/Solutions (52) 썸네일형 리스트형 [BAEKJOON] 2292번 처음에는 벌집을 구현해야 되는 건가 싶었는데, 규칙이 있었다. 123456789101112131415161718192021222324252627282930313233343536import java.util.Scanner; public class Main { public static void main(String[] args) { System.out.print(new Main().run()); } public String run() { Scanner scanner = new Scanner(System.in); long n = scanner.nextLong(); int count = 1; if(n == 1L) { scanner.close(); return "1"; } for(long na = 0L, nb =.. [BAEKJOON] 1924번 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int today = 0; int x = sc.nextInt(); int y = sc.nextInt(); int month = 1; for(month = 1; month [Project Euler] Problem 007 1234567891011121314151617181920212223242526272829303132333435363738#include int isPrime(int num); int main(){ int i; int count = 1; for (i = 2; count [Project Euler] Problem 006 수열의 합 공식을 안다면 별다른 알고리즘이 필요 없다. 이를 그대로 출력하기만 하면 된다. 12345678910111213#include #define MAX 100 int main(){ printf("Square of sum: %d\n", ((((MAX)*(MAX + 1)) / 2)*(((MAX)*(MAX + 1)) / 2))); printf("Sum of squares: %d\n", ((MAX*(MAX + 1)*(2 * MAX + 1)) / 6)); printf("Answer: %d\n", ((((MAX)*(MAX + 1)) / 2)*(((MAX)*(MAX + 1)) / 2)) - ((MAX*(MAX + 1)*(2 * MAX + 1)) / 6)); return 0;} Colored by Color S.. [Project Euler] Problem 005 사실 그냥 눈으로만 봐도 계산기 켜서 2⁴ × 3² × 5 × 7 × 11 × 13 × 17 × 19를 계산하면 된다는 것을 알 수 있다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public class Problem005 { public static void main(String[] args) { int dividend = 1; for(int i = 3; i [BAEKJOON] 11721번 12345678910public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.nextLine(); int i; for(i = 0; i [Project Euler] Problem 004 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465public class Problem004 { public static void main(String[] args) { int num; boolean s1 = false, s2 = false, s3 = false; boolean f1 = false, f2 = false; int max = 0; for(int i = 100; i max) { max = num; } } } else { // num max) { max = num; } } } } } System.out.printf("The larg.. [Project Euler] Problem 003 예전에 Java로 풀었던 문제다. 123456789101112131415161718192021222324252627282930313233343536public class Problem003 { public static void main(String[] args) { long num = 600851475143L; int[] primeFactors = new int[100]; int idx = 0; int i = 2; while((num / i != 1) || (num%i != 0)) { if(num%i == 0) { primeFactors[idx++] = i; num /= i; } else { i++; } if () { primeFactors[idx] = i; break; } } primeFactors[i.. Prev 1 ··· 3 4 5 6 7 Next