본문 바로가기

알고리즘/문제 풀이

SW Expert Academy 1933. 간단한 N 의 약수 SW Expert Academy SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 1. 틀렸던 것 import java.util.HashSet; import java.util.Iterator; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); HashSet set = new HashSet(); int N = sc.nextInt(); for (int i = 1; i 더보기
1938 아주 간단한 계산기 SW Expert Academy import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); System.out.println(a+b); System.out.println(a-b); System.out.println(a*b); System.out.println(a/b); } } 더보기
SW Expert Academy 2025 N줄 덧셈 SW Expert Academy SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int result = 0; for (int i = 1; i 더보기
SW Expert Academy 2027 대각선 출력하기 SW Expert Academy SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { ArrayList list = new ArrayList(); for (int i = 0; i < 5; i++) { // + 로만 이루어진 하나의 열을 생성 list.add("+"); } for (int i = 0; i < 5; i++) { // 하나의 열 출력을 5번 반복 list.set(i,"#"); // 자기 차례일 때.. 더보기
SW Expert Academy 2029 몫과 나머지 출력하기 SW Expert Academy SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int i = 0; i < T; i++) { int a = sc.nextInt(); int b = sc.nextInt(); System.out.printf("#%d %d %d\n", i+1, a/b, a%b); } } } 더보기
SW Expert Academy 2043 서랍의 비밀번호 SW Expert Academy SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int P = sc.nextInt(); // 패스워드 int K = sc.nextInt(); // 우리가 시작할 번호 if (P>=K) { System.out.println(P-K+1); }else { // 우리가 시작할 번호가 패스워드 보다 큰 경우, 999까지 찍고 다시 세야함 System.out.println((999-K +1) + P+1); } .. 더보기
SW Expert Academy 2046. 스탬프 찍기 SW Expert Academy SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); for (int i = 0; i < a; i++) { System.out.print("#"); } } } 이건 너무 쉽잖아! 더보기
SW Expert Academy 2047 신문 헤드라인 0. 문제 SW Expert Academy 1. 내가 푼 코드 import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String N = sc.nextLine(); ArrayList list = new ArrayList(); for (int i = 0; i = 97 && N.charAt(i) 더보기