์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด
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
์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด
[๋ฐฑ์ค 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
์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด
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
์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด
[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
์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด
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
์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด
๋ฐฑ์ค 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
์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด