본문 바로가기

728x90
반응형

프로그래밍

(122)
[자바] 정올 189 ~ 194 && 215, 216, 237 : 문자열2 - 형성평가 1 ~ 9 형성평가 1 : 189 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String[] arr = str.split(" "); for(int i = arr.length-1; i >=0; i--) System.out.println(arr[i]); } } 형성평가 2 : 190 import java.util.Scanner; public class Main { public static void main(String[] args) { String[] arr = {"flower", "rose"..
[자바] 정올 602~ 612 : 문자열2 - 자가진단1 ~ 11 자가진단1 : 602 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] arr = new String[5]; for(int i = 0; i = 0; i--) System.out.println(arr[i]); } } 자가진단2 : 603 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = ne..
[자바] 정올 182 ~ 188 : 문자열1 - 형성평가1 ~ 7 형성평가1 : 182 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char a = sc.next().charAt(0), b = sc.next().charAt(0); System.out.print(((int)a + (int)b) + " " + (Math.abs((int)a - (int)b)) ); } } 형성평가2 : 183 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(Syste..
[자바] 정올 593 ~ 601 : 문자열1 - 자가진단1~9 자가진단1 : 593 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 33; while(true){ System.out.print("ASCII code =? "); a = sc.nextInt(); if(a >=33 && a = str.length()){ for(int j = str.length() -1; j >= 0; j--) System.out.print(str.charAt(j)); }else{ for(int j = str.length() -1; j > str.length() -1 - i; j--) System.out..
[자바] 정올 231 ~ 236 : 함수3 - 형성평가1~6 형성평가1 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(n%2 == 0) solution_even(2, n); else solution_odd(1,n); } public static void solution_even(int a, int n){ if(a > n) return; else{ System.out.print(a + " "); a+=2; solution_even(a,n); } } public static void solution_odd(int a, int n){ if(a > n) ..
[자바] 정올 587 ~ 592 : 함수3 - 자가진단1~6 자가진단1 : 587 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int i = 0; solution(n, i); } public static void solution(int n, int i){ if(i == n) return; System.out.println("recursive"); i++; solution(n, i); } } 자가진단2: 588 import java.util.Scanner; public class Main { public static void main(String[] a..
[자바] 정올 175 ~ 181 : 함수2 - 형성평가1~7 형성평가1 : 175 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Integer[] arr = new Integer[n]; for(int i = 0;i
[자바] 정올 579 ~ 586 : 함수2 - 자가진단1~8 자가진단1 import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); Integer[] arr = new Integer[a]; for(int i = 0; i < a; i++) arr[i] = sc.nextInt(); arr_sort(arr); } public static void arr_sort(Integer[] arr){ Arrays.sort(arr, Collections.reverseOrder()); fo..

728x90
반응형