user-img
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด 231
SW Expert Academy 2046. ์Šคํƒฌํ”„ ์ฐ๊ธฐ
SW Expert Academy SW Expert Academy SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”! swexpertacademy.com import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); for (int i = 0; i < a; i++) { System.out.print("#"); } } } ์ด๊ฑด ๋„ˆ๋ฌด ์‰ฝ์ž–์•„!
2023.05.05
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
SW Expert Academy 2047 ์‹ ๋ฌธ ํ—ค๋“œ๋ผ์ธ
0. ๋ฌธ์ œ SW Expert Academy 1. ๋‚ด๊ฐ€ ํ‘ผ ์ฝ”๋“œ import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String N = sc.nextLine(); ArrayList list = new ArrayList(); for (int i = 0; i = 97 && N.charAt(i)
2023.05.04
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
SW 2047 ์‹ ๋ฌธ ํ—ค๋“œ๋ผ์ธ
SW Expert Academy 0. ๋ฌธ์ œ SW Expert Academy SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”! swexpertacademy.com 1. ํ’€์ด import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String N = sc.next(); ArrayList list = new ArrayList(); for (int i = 0; i < N.length(); i++) { list.add(N.charAt(i) - 64); } for (in..
2023.05.04
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
SW Academy D1 - ์—ฐ์›”์ผ ๋‹ฌ๋ ฅ
0. ๋ฌธ์ œ SW Expert Academy SW Expert Academy SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”! swexpertacademy.com 1. ๋‚ด ํ’€์ด import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); sc.nextLine(); ArrayList list = new ArrayList(); for (int i = 1; i 12 || month < 1) { System.out.println("#"..
2023.05.04
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
2058 ์ค‘๊ฐ„๊ฐ’ ๋”ํ•˜๊ธฐ
SW Expert Academy SW Expert Academy SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”! swexpertacademy.com 1. ๋‚ด๊ฐ€ ํ‘ผ ๋ฐฉ๋ฒ• ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ ๊ฐ’์ด ํ•œ ์ž๋ฆฌ ์ˆ˜์—์„œ 4์ž๋ฆฌ ์ˆ˜๋กœ ๋‹ค์–‘ํ•  ์ˆ˜ ์žˆ์Œ์œผ๋กœ, ๊ฐ ์ƒํ™ฉ์— ๋งž๋Š” if ๋ถ„๊ธฐ๋ฅผ ๋งŒ๋“ค์–ด์„œ, ํ•˜๋“œ์ฝ”๋”ฉ ํ–ˆ๋‹ค. import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); System.out.println(Calc(N)); } static int Calc(int N) { if(9999>=N &&..
2023.05.04
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
SW Expert Academy D1 - 2063 ์ค‘๊ฐ„๊ฐ’ ์ฐพ๊ธฐ
https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV5QPsXKA2UDFAUq&categoryId=AV5QPsXKA2UDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=1&pageSize=10&pageIndex=1 SW Expert Academy SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”! swexpertacademy.com 1. Old school ๋กœ ํ’€๊ธฐ ๋งจ ์ฒซ ์ผ€์ด์Šค์—์„œ ๋ฐ›์€ ๋ฐฐ์—ด์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ์ด์šฉํ•ด ๋ฐฐ์—ด์„ ๋งŒ๋“ค๊ณ  ๊ทธ ํ›„ ๋‚˜์—ด๋œ ๊ฐ’๋“ค์„ ๋ฐฐ์—ด์—..
2023.05.02
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
์˜ˆ์™ธ ์ฒ˜๋ฆฌ _Quiz_11
public class _Quiz_11 { public static void main(String[] args) { int errorCode = 0; try{ if(errorCode ==0) { System.out.println("์ƒํ’ˆ ๊ตฌ๋งค๋ฅผ ์™„๋ฃŒํ•˜์˜€์Šต๋‹ˆ๋‹ค."); } else if(errorCode == 1) { throw new timeOutException("์ƒํ’ˆ ๊ตฌ๋งค ๊ฐ€๋Šฅ ์‹œ๊ฐ„์ด ์•„๋‹™๋‹ˆ๋‹ค."); } else if (errorCode == 2) { throw new soldOutException("ํ•ด๋‹น ์ƒํ’ˆ์€ ๋งค์ง„๋˜์—ˆ์Šต๋‹ˆ๋‹ค."); } }catch (timeOutException e){ System.out.println(e.getMessage()); System.out.println("์ƒํ’ˆ ๊ตฌ๋งค๋Š” 20..
2023.03.09
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
๋ฐฑ์ค€ 10818๋ฒˆ ์ตœ๋Œ€ ์ตœ์†Œ
์ŠคํŠธ๋ฆผ์„ ๋ฐฐ์šฐ๊ณ  ๋ชจ๋“ ๊ฒŒ ์‰ฌ์›Œ์ง„ ๋‚˜ orElse ๋ฌธ ์•ˆ ์“ฐ๋ฉด Optional int ๋ž€ ์ž๋ฃŒํ˜•์œผ๋กœ ๋‚˜์˜ด. ์™œ๋ƒ๋ฉด ๋งŒ์•ฝ ๋ฐฐ์—ด์ด ๋น„์–ด์žˆ์„ ๊ฒฝ์šฐ์— ๋Œ€ํ•œ ๋Œ€์ฒ˜๋ฅผ ์•ˆ ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ๋”ฐ๋ผ์„œ orElse(0)๋ฅผ ํ•ด์ค˜์•ผ ์ปดํŒŒ์ผ๋Ÿฌ๊ฐ€ ๋ฏฟ๊ณ  int๋กœ ๋ณ€ํ™˜ํ•ด์ค€๋‹ค. import java.util.Scanner; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] b = new int[N]; for (int i = 0; i < N; i++) { b[i] = sc.nextInt(); } int mi..
2023.02.28
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[JAVA ํ€ด์ฆˆ #10] ๋‚˜๋„ ์ฝ”๋”ฉ
import java.util.ArrayList; import java.util.Arrays; public class _Quiz_10 { public static void main(String[] args) { Customer c1 = new Customer("์ฑˆ๋“ค๋Ÿฌ", 50); Customer c2 = new Customer("๋ ˆ์ด์ฒผ", 42); Customer c3 = new Customer("๋ชจ๋‹ˆ์นด", 21); Customer c4 = new Customer("๋ฒค์ž๋ฏผ", 18); Customer c5 = new Customer("์ œ์ž„์Šค", 5); System.out.println("๋ฏธ์ˆ ๊ด€ ์ž…์žฅ๋ฃŒ"); System.out.println("-----------------"); ArrayList list..
2023.02.23
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
JAVA Quiz 09
import java.util.ArrayList; public class _Quiz_09 { public static void main(String[] args) { ArrayList stuList = new ArrayList(); stuList.add(new student("์œ ์žฌ์„", "ํŒŒ์ด์ฌ")); stuList.add(new student("๋ฐ•๋ช…์ˆ˜", "์ž๋ฐ”")); stuList.add(new student("๊น€์ข…๊ตญ", "์ž๋ฐ”")); stuList.add(new student("์กฐ์„ธํ˜ธ", "C")); stuList.add(new student("์„œ์žฅํ›ˆ", "ํŒŒ์ด์ฌ")); System.out.println("์ž๋ฐ” ์ž๊ฒฉ์ฆ์„ ๋ณด์œ ํ•œ ํ•™์ƒ"); System.out.println("--------------..
2023.02.15
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
thumbnail
[๋ฐฑ์ค€ 1110 ๋ฒˆ] ๋”ํ•˜๊ธฐ ์‚ฌ์ดํด
1. ๋‚ด ํ‹€๋ฆฐ ์ฝ”๋“œ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int Origin; int a = 0; int b = 0; int c = 0; int temp = 0; Integer i = 0; Origin = sc.nextInt(); c = Origin; sc.close(); System.out.println(Origin); System.out.println(c); if(Origin < 10){ Origin *= 10; } while (true){ a = Origin/10; b = Origin%10; temp = a + b; ..
2023.02.13
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[๋ฐฑ์ค€ 10951๋ฒˆ] A+B -4
while(true)๋กœ ํ•˜๋ฉด ์ž…๋ ฅ์ด ์—†์–ด๋„ ๊ณ„์† ๋ˆ๋‹ค. ์ž…๋ ฅ์ด ์—†์œผ๋ฉด break ๋˜์–ด์•ผ ํ•œ๋‹ค. ๊ทธ๋Ÿฐ ์˜๋ฏธ์—์„œ while(sc.hasNextInt()) ๊ฐ€ ๋˜์–ด์•ผ ํ•œ๋‹ค. import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList a = new ArrayList(); ArrayList b = new ArrayList(); int i = 0; while(sc.hasNextInt()) { a.add(sc.nextInt() + sc.nextInt()); System.out.println..
2023.02.11
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[๋ฐฑ์ค€ 10952๋ฒˆ] A+B -5
ArrayList ๋ฐฐ์šฐ๋‹ˆ ์‚ด ๊ฒƒ ๊ฐ™๋‹ค. ํŒ”์ด ํ•˜๋‚˜ ๋” ์ƒ๊ธด ๋Š๋‚Œ. import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList a = new ArrayList(); ArrayList b = new ArrayList(); while(true){ a.add(sc.nextInt()); b.add(sc.nextInt()); if(a.contains(0)&&b.contains(0)) break; } if(a.contains(0)&&..
2023.02.10
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[๋ฐฑ์ค€ 2439๋ฒˆ] ๋ณ„ ์ฐ๊ธฐ 2
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); for (int i = 0; i < n; i++) { for (int j = 0; j < n -(i+1); j++) { System.out.print(" "); } for (int k = 0; k < i+1; k++) { System.out.print("*"); } System.out.println(); } } }
2023.02.08
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[๋ฐฑ์ค€ 2438๋ฒˆ] ๋ณ„ ์ฐ๊ธฐ
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); for (int i = 0; i < n; i++) { for (int j = 0; j < (i+1); j++) { System.out.print("*"); } System.out.println(); } } }
2023.02.08
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[๋ฐฑ์ค€ 11022๋ฒˆ]
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); } for (int i = 0; i < n; i++) { System.out.println("Case #" +(i+1) +": "+ a[i] + " + " +b[i]+ " = "+ (a[i] + b[i])); } } }
2023.02.08
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
[๋ฐฑ์ค€ 11021๋ฒˆ]
import java.util.Scanner; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); } for (int i = 0; i < n; i++) { System.out.println("Case #" +(i+1) +": " + (a[i] + b[i])); } } }
2023.02.08
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
thumbnail
JAVA QUIZ 08
//main๋งค์†Œ๋“œ package Chap_08; import Chap_08.Camera.SpeedCam; import Chap_08.detector.AccidentDetector; import Chap_08.reporter.VideoReporter; public class _Quiz_08 { public static void main(String[] args) { SpeedCam speedCam = new SpeedCam(); speedCam.setDetector(new AccidentDetector()); speedCam.setReporter(new VideoReporter()); speedCam.detect(); speedCam.report(); } } package Chap_08.detector; ..
2023.02.02
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
thumbnail
[JAVA QUIZ] ํ–„๋ฒ„๊ฑฐ ์ฃผ๋ฌธ์„œ ๋งŒ๋“ค๊ธฐ
package Chap_07; class Hambuger { // ์ธ์Šคํ„ด์Šค ๋ณ€์ˆ˜ public String name; public String ingredient1; public String ingredient2; public String ingredient3; // ์ƒ์„ฑ์ž public Hambuger(){ this("ํ–„๋ฒ„๊ฑฐ"); } public Hambuger(String name){ this.name = name; this.ingredient1 = "์–‘์ƒ์ถ”"; this.ingredient2 = "ํŒจํ‹ฐ"; this.ingredient3 = "ํ”ผํด"; } // ๋งค์†Œ๋“œ public void cook() { System.out.println(name + "๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค."); System.out.println(..
2023.01.29
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
thumbnail
Java_Quiz_06_๊ฐœ์ธ์ •๋ณด ๋ณดํ˜ธ ๋งค์†Œ๋“œ ๋งŒ๋“ค๊ธฐ
1.๋ฌธ์ œ ์„ค๋ช… (1) ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„, ์ฃผ๋ฏผ๋“ฑ๋ก๋ฒˆํ˜ธ, ์ „ํ™”๋ฒˆํ˜ธ ๊ทธ๋ฆฌ๊ณ  ์ด ๊ฐœ์ธ ์ •๋ณด์—์„œ ๋ณด์—ฌ์ค„ ๊ธ€์ž์˜ ์ˆ˜๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ํ•ด๋‹น ๊ธ€์ž๊นŒ์ง€๋งŒ ๋ณด์ด๊ณ  ๋‚˜๋จธ์ง€๋Š” *๋กœ ๋Œ€์ฒดํ•˜์—ฌ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ๊ตฌํ˜„ํ•˜๋ผ ex) ๋‚˜์ฝ”๋”ฉ, 990130-1234567,010-1234-5678์ด ์ฃผ์–ด์กŒ์„ ๋•Œ ๊ฐ๊ฐ 1, 8, 9๊ฐœ์˜ ๊ธ€์ž๋งŒ ๋ณด์ด๊ณ  ๋‚˜๋จธ์ง€๋Š” *๋กœ ๋Œ€์ฒดํ•˜์—ฌ ์ถœ๋ ฅํ•˜์‹œ์˜ค. // ์ฃผ์–ด์ง„ ์ฝ”๋“œ // getHiddenData๋ฅผ ๊ตฌํ˜„ํ•ด์•ผํ•จ. String name = "๋‚˜์ฝ”๋”ฉ"; // ์ด๋ฆ„ String id = "990130-1234567"; // ์ฃผ๋ฏผ๋“ฑ๋ก๋ฒˆํ˜ธ String phone = "010-1234-5678"; // ์ „ํ™”๋ฒˆํ˜ธ System.out.println("์ด๋ฆ„: " + getHiddenData(name, 1)); System.ou..
2023.01.25
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด
thumbnail
๋ฐฑ์ค€ 15552 ๋ฌธ์ œ(๋น ๋ฅธ A+B) Code review
1. ๋ฌธ์ œ ๋ถ„์„ ๋ฌธ์ œ์˜ ์š”๊ตฌ ์กฐ๊ฑด์€ 1.5์ดˆ์•ˆ์— ์ตœ๋Œ€ 1,000,000๊ฐœ ์ด์ƒ์˜ ๋”ํ•˜๊ธฐ ์—ฐ์‚ฐ์„ ํ•˜์—ฌ ํ•˜๋‚˜ ํ•˜๋‚˜ ์ถœ๋ ฅํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์—ฌ๊ธฐ์„œ ์ค‘์š”ํ•œ ๊ฒƒ์€ 1.5์ดˆ๋ผ๋Š” ์‹œ๊ฐ„์ด๋‹ค. 2. ๊ธฐ์กด์— ์ž…์ถœ๋ ฅ์„ ๋‹ด๋‹นํ•˜๋˜ scanner๋กœ ๋ฌธ์ œ๋ฅผ ํ’€๋ฉด ์•ˆ๋˜๋Š” ์ด์œ  scanner๋Š” ์ž…๋ ฅ ๋ฐ›์€ ๊ตฌ๋ฌธ ๋ถ„์„์„ ์œ„ํ•ด ์ •๊ทœ์‹์„ ๋‚จ๋ฐœํ•œ๋‹ค. ์‹ค์ œ๋กœ Scanner ๋‚ด๋ถ€ ์ฝ”๋“œ๋ฅผ ๋œฏ์–ด๋ณด๋ฉด, ์ž…๋ ฅ ๋ฐ›์€ ๊ตฌ๋ฌธ์„ ๋ถ„์„ํ•˜๊ธฐ ์œ„ํ•ด ๋งŽ์€ ๋ช…๋ น์„ ๊ฑฐ์นœ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋”ฐ๋กœ ์ž…๋ ฅ ๋ฐ›์€ ๊ฐ’์— ๋Œ€ํ•œ ๊ตฌ๋ฌธ๋ถ„์„์ด ์—†๋Š” BufferedReader๋ฅผ ํ†ตํ•ด ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ ํ’€์–ด์•ผํ•œ๋‹ค. 3. ํ•ด๋‹ต์ฝ”๋“œ import java.io.*; import java.util.StringTokenizer; public class main { public static void ..
2023.01.25
์•Œ๊ณ ๋ฆฌ์ฆ˜/๋ฌธ์ œ ํ’€์ด