[๋ฐฑ์ค€] 12๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
12 ์ •๋ ฌ ๋ฐฐ์—ด์˜ ์›์†Œ๋ฅผ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜ 1 2750 ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ ์‹œ๊ฐ„ ๋ณต์žก๋„๊ฐ€ O(n²)์ธ ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ํ’€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ์‚ฝ์ž… ์ •๋ ฌ, ๊ฑฐํ’ˆ ์ •๋ ฌ ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException{ BufferedReader bfr = new Buff..
[๋ฐฑ์ค€] 11๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
11 ๋ธŒ๋ฃจํŠธ ํฌ์Šค ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ธ, ๋ชจ๋“  ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ ๊ฒ€์‚ฌํ•˜๋Š” ๋ธŒ๋ฃจํŠธ ํฌ์Šค ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๋ฐฐ์›Œ ๋ด…์‹œ๋‹ค. 1 2798 ๋ธ”๋ž™์žญ import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int T = scan.nextInt(); int Max = scan.nextInt(); int n[] = new int [T]; for(int i = 0; i
[๋ฐฑ์ค€] 10๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
10๋‹จ๊ณ„. ์žฌ๊ท€ ์žฌ๊ท€ํ•จ์ˆ˜๋ฅผ ๋‹ค๋ค„ ๋ด…์‹œ๋‹ค. 1 10872 ํŒฉํ† ๋ฆฌ์–ผ ์žฌ๊ท€ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด์„œ ์ œ์ถœํ•ด์•ผํ•œ๋‹ค. import java.util.Scanner; public class Main { static int factory = 1; public static int fac(int num) { if(num ==0) return factory; else{ factory *= num; return fac(num-1); } } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); fac(x); System.out.println(factory); } } 2 10870 ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜ 5 ์ด ๋ฌธ์ œ ..
[๋ฐฑ์ค€] 9๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
1 1978 ์†Œ์ˆ˜ ์ฐพ๊ธฐ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int T = scan.nextInt(); int count = 0; for(int t = 0; t
[๋ฐฑ์ค€] 8๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
1 1712 ์†์ต๋ถ„๊ธฐ์  ์ฒ˜์Œ์—๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•˜์—ฌ ์‹œ๊ฐ„์ดˆ๊ณผ๊ฐ€ ์ผ์–ด๋‚ฌ๋‹ค. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long A = scan.nextInt(); long B = scan.nextInt(); long C = scan.nextInt(); scan.close(); long count = 1; while(true) { if(B>=C) { System.out.println(-1); break;} if(A + B*count >= C*count) { count++; continue; } if(A + B*count < C..
[๋ฐฑ์ค€] 7๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
1 11654 ์•„์Šคํ‚ค ์ฝ”๋“œ public class Main { public static void main(String[] args) throws Exception{ int a = System.in.read(); System.out.println(a); } } 2 11720 ์ˆซ์ž์˜ ํ•ฉ import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int a[] = new int[scan.nextInt()]; int sum = 0; String x = scan.next(); for(in..
[๋ฐฑ์ค€] 6๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
1 15596 ์ •์ˆ˜ N๊ฐœ์˜ ํ•ฉ public class Test { long sum(int[] a) { long ans = 0; for(int i=0; i
[๋ฐฑ์ค€]5๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
1 10818 ์ตœ์†Œ, ์ตœ๋Œ€ import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int T = scan.nextInt(); int a[] = new int[T]; for(int i=0; i
[HackerRank] Solve Java
ยท
Hi๐Ÿ–๏ธ/Java
2. Java If-Else import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int N = scanner.nextInt(); scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?"); if (N%2 != 0) {Sys..
[๋ฐฑ์ค€]4๋‹จ๊ณ„ ๋ฌธ์ œ ๋ชจ์Œ
ยท
Hi๐Ÿ–๏ธ/Java
์ œ๋ชฉ์— ๋งํฌ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ํ•ด๋‹น ๋ฌธ์ œ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. 1 10952 A+B - 5 Java 0 0์ด ๋“ค์–ด์˜ฌ ๋•Œ๊นŒ์ง€ A+B๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ๋ฌธ์ œ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.out)); int A =1; int B =1; while(true) { StringTokenizer st = ..
Liky
'Hi๐Ÿ–๏ธ/Java' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก