본문 바로가기

practice77

[백준 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. 2.
[백준 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. 1.
[백준 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. 1.
[백준 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.
[백준 03512] Flat [Java] 문제 You are one of the developers of software for a real estate agency. One of the functions you are to implement is calculating different kinds of statistics for flats the agency is selling. Each flat consists of different types of rooms: bedroom, bathroom, kitchen, balcony and others. The cost of the flat is equal to the product of reduced total area and the cost of one square metre. Reduced to.. 2023. 11. 27.
[백준 03507] Automated Telephone Exchange [Java] 문제 In St Petersburg phone numbers are formatted as “XXX–XX–XX”, where the first three digits represent index of the Automated Telephone Exchange (ATE). Each ATE has exactly 10 000 unique phone numbers. Peter has just bought a new flat and now he wants to install a telephone line. He thinks that a phone number is lucky if the arithmetic expression represented by that phone number is equal to zero.. 2023. 11. 27.