목록개인 공부/프로그래머스 (36)
Develop

문제 내풀이 import java.util.Scanner; public class Solution { public static void main(String[] args) { System.out.print("!@#$%^&*("+"\\'\"?:;"); } } 느낀점 이스케이프 문자를 출력하려면 문자앞에 \ (역슬러쉬)를 적어줘야 한다는 사실을 알았다 다른 특수문자들은 문제 없지만 \ 와 " 는 이스케이프 문자라서 앞에 꼭 \를 넣어야 문자로 인식한다

문제 내 풀이 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.next(); // 전체 글자수 확인 int len = a.length(); int count = 0; 글자수만큼 while 동작 while(--len >=0) { // while문 안에서 글자를 차례대로 하나씩 가져옴 String al = a.substring(count, count+1);; // 가져온 글자의 대문자와 비교한 후 같으면 소문자, 다르면 대문자를 출력 if(al.equals(al.toUpperCase())) { System..

문제 내풀이 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 + " = " + (a+b)); } } 다른 답 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 = s..

문제 내 풀이 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int n = sc.nextInt(); while(n>0){ System.out.print(str); n--; } } } 모범 답안1 import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.next(); int n = sc...