본문 바로가기
728x90
반응형

알고리즘/SWEA23

2058. 자릿수 더하기. D1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int[] intArr = new int[s.length()]; int sum=0; for(int i=0;ichar->int 2. charAt(index): 문자열에서 인덱스별로 문자로 가져오는 3. -'0': 문자를 정수로 만들기 위해선 문자 '0'을 빼주면 된다. 2022. 2. 5.
2063. 중간값 찾기.D1* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n % 2 == 1) { int[] intArr= new int[n]; for (int i = 0.. 2022. 2. 5.
2070. 큰 놈, 작은 놈, 같은 놈.D1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System... 2022. 2. 4.
2071. 평균값 구하기. D1 1234567891011121314151617181920212223242526272829303132333435363738394041 import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = .. 2022. 2. 4.
2072. 홀수만 더하기. D1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilde.. 2022. 2. 4.
728x90
반응형