Algorithm504 Programmers 하샤드 수 JAVA 문제 코딩테스트 연습 - 하샤드 수 양의 정수 x가 하샤드 수이려면 x의 자릿수의 합으로 x가 나누어져야 합니다. 예를 들어 18의 자릿수 합은 1+8=9이고, 18은 9로 나누어 떨어지므로 18은 하샤드 수입니다. 자연수 x를 입력받아 x가 하 programmers.co.kr 풀이 입력받은 값을 나머지 연산으로 계속하여 1의 자리의 수를 구하고 10을 나누어서 1의 자리를 없애고 10의 자리의 수를 1의 자리의 수로 내린다. ex) x=1234 x%=10 => 4 x/=10 => 123 x%=10 => 3 x/=10 => 12 이렇게 하면 입력받은 숫자를 한자리씩 더할 수 있게된다. 이렇게 구한 harshad값을 처음에 y에 백업해둔 x의 값을 이용해서 나머지를 구해 나머지가 0이 아니면 나눠 떨어진 .. 2022. 5. 5. Programmers 핸드폰 번호 가리기 JAVA 문제 코딩테스트 연습 - 핸드폰 번호 가리기 프로그래머스 모바일은 개인정보 보호를 위해 고지서를 보낼 때 고객들의 전화번호의 일부를 가립니다. 전화번호가 문자열 phone_number로 주어졌을 때, 전화번호의 뒷 4자리를 제외한 나머지 숫자 programmers.co.kr 풀이 입력받은 핸드폰의 길이-4 만큼을 반복해서 for문을 수행하며 *을 answer에 더해준다. 마지막에 핸드폰 길이 -4 부터 끝까지의 값을 answer에 붙여서 *로 마스킹한 번호를 출력한다. 코드 class Solution { public String solution(String phone_number) { String answer = ""; for(int i=0;i 2022. 5. 5. Baekjoon 20215 Cutting Corners JAVA 20215번: Cutting Corners A large coffee spill in the warehouse of the Busy Association of Papercutters on Caffeine has stained the corners of all paper in storage. In order to not waste money, it was decided that these dirty corners should be cut off of all pieces of paper. A few www.acmicpc.net 문제 A large coffee spill in the warehouse of the Busy Association of Papercutters on Caffeine has stain.. 2022. 5. 5. Baekjoon 21335 Another Eruption JAVA 21335번: Another Eruption A volcano has recently erupted in Geldingadalur, Iceland. Fortunately this eruption is relatively small, and---unlike the infamous Eyjafjallajökull eruption---is not expected to cause delayed international flights or global outrage. There is some concern www.acmicpc.net 문제 A volcano has recently erupted in Geldingadalur, Iceland. Fortunately this eruption is relatively s.. 2022. 5. 5. Baekjoon 20352 Circus JAVA 20352번: Circus In the modern world, the spotlight has shifted entirely from live shows to televised recordings. Well, not entirely... One small troupe of indomitable entertainers still holds out and puts on regular circus performances. The shows are extremely popular. www.acmicpc.net 문제 In the modern world, the spotlight has shifted entirely from live shows to televised recordings. Well, not ent.. 2022. 5. 5. Baekjoon 1051 숫자 정사각형 JAVA 1051번: 숫자 정사각형 N×M크기의 직사각형이 있다. 각 칸에는 한 자리 숫자가 적혀 있다. 이 직사각형에서 꼭짓점에 쓰여 있는 수가 모두 같은 가장 큰 정사각형을 찾는 프로그램을 작성하시오. 이때, 정사각형은 행 www.acmicpc.net 문제 N×M크기의 직사각형이 있다. 각 칸에는 한 자리 숫자가 적혀 있다. 이 직사각형에서 꼭짓점에 쓰여 있는 수가 모두 같은 가장 큰 정사각형을 찾는 프로그램을 작성하시오. 이때, 정사각형은 행 또는 열에 평행해야 한다. 입력 첫째 줄에 N과 M이 주어진다. N과 M은 50보다 작거나 같은 자연수이다. 둘째 줄부터 N개의 줄에 수가 주어진다. 출력 첫째 줄에 정답 정사각형의 크기를 출력한다. 풀이 코드 참조 코드 import java.io.*; import j.. 2022. 5. 4. Baekjoon 20353 Atrium JAVA 20353번: Atrium The atrium of a traditional Roman dormus, much like the atria of today, is a perfectly square room designed for residents and guests to congregate in and to enjoy the sunlight streaming in from above. Or, in the case of Britannia, the rain streaming in fro www.acmicpc.net 문제 The atrium of a traditional Roman dormus, much like the atria of today, is a perfectly square room designed.. 2022. 5. 4. Baekjoon 8723 Patyki JAVA 8723번: Patyki Pierwszy wiersz wejścia zawiera trzy liczby całkowite a, b, c (1 ≤ a, b, c ≤ 1000), oznaczające odpowiednio długości pierwszego, drugiego i trzeciego patyka. www.acmicpc.net 문제 Bajtuś znalazł w lesie 3 patyki. Teraz chciałby wiedzieć, czy może z nich zbudować trójkąt prostokątny lub równoboczny. Bajtuś nie może łamać patyków, może je wykorzystać tylko w całości. 입력 Pierwszy wiersz .. 2022. 5. 4. Baekjoon 16600 Contemporary Art JAVA 16600번: Contemporary Art At the Van Abbemuseum of modern and contemporary art in Eindhoven, we always look to present our muses in the most interesting way possible. Sometimes we have our work cut out for us. Today we are exploring whether we can modify one of our perfectly-square www.acmicpc.net 문제 At the Van Abbemuseum of modern and contemporary art in Eindhoven, we always look to present our .. 2022. 5. 4. 이전 1 ··· 15 16 17 18 19 20 21 ··· 56 다음 728x90 728x90