Implementation(115)
-
[백준 04084] Viva la Diferencia [Java]
문제 네 개의 양의 정수 a, b, c, d가 있을 때, 아래와 같이 차이를 계산할 수 있다. |a-b| |b-c| |c-d| |d-a| 이렇게 나온 네 개의 수를 이용해서 다시 또 차이를 계산할 수 있다. 이 작업을 모든 네 개의 정수가 같아질 때까지 반복한다. 예를 들어, 1, 3, 5, 9로 시작했을 때를 생각해보자. 1 3 5 9 2 2 4 8 (1) 0 2 4 6 (2) 2 2 2 6 (3) 0 0 4 4 (4) 0 4 0 4 (5) 4 4 4 4 (6) 위의 경우에서 수열은 6번 만에 수렴한다. a, b, c, d가 주어졌을 때, 이 수열이 얼마나 빨리 수렴하는지 구하는 프로그램을 작성하시오. 입력 입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있고, ..
2023.12.02 -
[백준 03554] Enigmatic Device [Java]
문제 Yes, it happened! The first contact! Aliens will visit the Earth in 2010! And they promised to bring an enigmatic device which cannot be constructed using existing Earth technologies. Most of the scientists of the world think so! All newspapers already published their leading articles about it. The amazing thing about this device is that it is able to perform 50,000 operations of this kind wi..
2023.12.01 -
[백준 03578] Holes [Java]
문제 You may have seen a mechanic typewriter — such devices were widespread just 15 years ago, before computers replaced them. It is a very simple thing. You strike a key on the typewriter keyboard, the corresponding type bar rises, and the metallic letter molded into the type bar strikes the paper. The art of typewriter typing, however, is more complicated than the art of computer typing. You sho..
2023.12.01 -
[백준 03533] Explicit Formula [Java]
문제 Consider 10 Boolean variables x1, x2, x3, x4, x5, x6, x7, x8, x9, and x10. Consider all pairs and triplets of distinct variables among these ten. (There are 45 pairs and 120 triplets.) Count the number of pairs and triplets that contain at least one variable equal to 1. Set f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = 1 if this number is odd and f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = 0 ..
2023.11.29 -
[백준 03276] ICONS [Java]
문제Dave has a collection of N interesting pebbles. He wishes to arrange them in rows and columns in such a way that the sum of number of rows and number of columns needed is minimal possible. Write a program that will help Dave to find such numbers. 입력The first and only line of input file contains a natural number N (1 ≤ N ≤ 100), the number of pebbles to be arranged. Arrangement needs not to be ..
2023.11.24