알고리즘/SWEA2023. 8. 14. 19:46[D2] 1288 - 새로운 불면증 치료법

package SWEA; import java.util.Scanner; public class Solution1288 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int test_case = 1; test_case

알고리즘/SWEA2023. 8. 14. 19:42[D2] 1284 - 수도 요금 경쟁

package SWEA; import java.util.Scanner; public class Solution1284 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int test_case=1; test_case R ? Q + (W - R) * S : Q; System.out.printf("#%d %d\n",test_case,A

알고리즘/SWEA2023. 8. 14. 19:26[D2] 1204 - 최빈수 구하기

최빈수는 가장 여러 번 나타나는 값을 의미 package SWEA; import java.util.Scanner; public class Solution1204 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int test_case=1; test_case

알고리즘/SWEA2023. 8. 12. 16:42[D1] 2056 - 연월일 달력

package SWEA; import java.util.Scanner; public class Solution2056 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); //TestCase T int[] arr = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; //1~12월의 일수배열 생성 // 1 2 3 4 5 6 7 8 9 10 11 12 for(int i=1; i

알고리즘/SWEA2023. 8. 12. 16:36[D1] 2058 - 자릿수 더하기

package SWEA; import java.util.Scanner; public class Solution2058 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); int sum = 0; while(num > 0) { //num이 0보다 크면 반복 sum+=num%10; //num을 10으로 나눈 나머지값을 sum에 누적합하여 저장 num/=10; //num의 1의자리수를 제거 ex)12345 -> 1234 } System.out.println(sum); } }

알고리즘/SWEA2023. 8. 12. 16:31[D1] 2063 - 중간값 찾기

package SWEA; import java.util.Arrays; import java.util.Scanner; public class Solution2063 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int center=0; //중간값 위치 center변수 int n = sc.nextInt(); //입력되는 숫자의 개수 n int[] num = new int[n]; for(int i=0; i

알고리즘/SWEA2023. 8. 12. 16:27[D1] 2068 - 최대수 구하기

package SWEA; import java.util.Scanner; public class Solution2068 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); //TestCase변수 T for(int i=1; i

알고리즘/SWEA2023. 8. 12. 16:23[D1] 2070 - 작은 놈, 같은 놈, 큰 놈

package SWEA; import java.util.Scanner; public class Solution2070 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); //TestCase변수 T for(int i=1; i num2) { System.out.println("#" + i + " >" ); } } } }

image