https://www.acmicpc.net/problem/2743정답import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); System.out.println(str.length()); }}
JAVA
https://www.acmicpc.net/problem/27866 정답import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); int i = Integer.parseInt(br.readLine())-1; System.out.print..
charAt() 함수란?String 타입의 데이터(문자열)에서 특정 문자를 char 타입으로 변환할 때 사용하는 함수 이다.charAt(num) : num 자리에는 int형 변수를 넣어서 원하는 위치 가져올 수 있다.public static void main(String[] args) { String example = "안녕하세요"; char target1; char target2; char target3; target1 = example.charAt(0); target2 = example.charAt(1); target3 = example.charAt(2); System.out.println(target1);//안..
https://www.acmicpc.net/problem/1546정답import java.util.Arrays;import java.util.StringTokenizer;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); double arr[] = new double[Integer.pa..
https://www.acmicpc.net/problem/10811문제 해석 (예제 입력1)배열 크기는 5개 , 4번 바꾸기 실행한다예시로 [1,2,3,4,5]1 2 ⇒ [2,1,3,4,5]3 4 ⇒ [2,1,4,3,5]1 4 ⇒ [3,4,1,2,5]2 2 ⇒ [3,4,1,2,5] 1 4 라면1번째 배열 → 4번째 배열2번째 배열 → 3번째 배열3번째 배열 → 2번째 배열4번째 배열 → 1번째 배열정답import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main{ public stati..
https://www.acmicpc.net/problem/3052정답import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.HashSet;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); HashSet h = new HashSet(); for(int i=0;i풀이과정서로 다른 나머지 ⇒중복 허용이 안됨 ⇒Has..
에러원인배열의 인덱스 접근이 잘못되었기 때문에배열의 인덱스 범위를 초과하여 접근하려고 할 때 발생합니다.index는 0부터 시작해서 ~ 배열의 크기-1까지예시1import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer s..
https://www.acmicpc.net/problem/10871정답import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); ..
https://www.acmicpc.net/problem/10807정답import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringTokenizer st ..
https://www.acmicpc.net/problem/10951정답import java.io.IOException;import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; StringBuilder sb = new StringBuilder(); ..