๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
728x90
๋ฐ˜์‘ํ˜•

์ฝ”๋”ฉํ…Œ์ŠคํŠธ๊ณต๋ถ€3

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ์ฃผ์‹๊ฐ€๊ฒฉ/Java - Lv.2 โ“๋ฌธ์ œ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”.programmers.co.kr๐Ÿ“Œ์œ ํ˜•์Šคํƒ ๋˜๋Š” ํ ๋˜๋Š” ๋‹จ์ˆœ ๋ฐ˜๋ณต๋ฌธโœ๐Ÿปํ’€์ดํ˜„์žฌ ์ฃผ์‹๊ฐ€๊ฒฉ์ด ์‹œ๊ฐ„์ด ์ง€๋‚˜๋ฉด์„œ ๋ฐ”๋€ ๊ฐ€๊ฒฉ์ด ํ˜„์žฌ ๊ฐ€๊ฒฉ๊ณผ ๊ฐ™๊ฑฐ๋‚˜ ํฌ๋‹ค๋ฉด ์‹œ๊ฐ„์„ ๊ณ„์† 1์”ฉ ์ฆ๊ฐ€.ํ˜„์žฌ ๊ฐ€๊ฒฉ๋ณด๋‹ค ์ž‘์•„์ง„๋‹ค๋ฉด ๋ฐ˜๋ณต๋ฌธ์„ ๋ฉˆ์ถค.๐Ÿ’ป์ฝ”๋“œ/** ๋ฐ˜๋ณต๋ฌธ์„ ์‚ฌ์šฉํ•œ ํ’€์ด**/import java.util.*;class Solution { public int[] solution(int[] prices) { int[] answer = new int[prices.length]; for(int i = 0; i prices[.. 2024. 9. 29.
[Baekjoon] 2750. ์ˆ˜ ์ •๋ ฌํ•˜๊ธฐ/Java - Bronze2 โ“๋ฌธ์ œhttps://www.acmicpc.net/problem/2750๐Ÿ“Œ์œ ํ˜•์ •๋ ฌโœ๐Ÿปํ’€์ด0์—์„œ๋ถ€ํ„ฐ n-1๊นŒ์ง€ ๋ฐ˜๋ณต๋ฌธ ์ˆ˜ํ–‰.i+1์—์„œ๋ถ€ํ„ฐ n-1๊นŒ์ง€ ๋ฐ˜๋ณต๋ฌธ์„ ์ˆ˜ํ–‰ํ•˜๋ฉด์„œ i์™€ i+1์„ ๋น„๊ตํ•˜๋ฉฐ ์ •๋ ฌ.๐Ÿ’ป์ฝ”๋“œimport java.util.*;public class Main { static int n; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i a[j]){ int temp = a[i]; .. 2024. 9. 28.
[Baekjoon] 1546. ํ‰๊ท /Java - Bronze1 โ“๋ฌธ์ œhttps://www.acmicpc.net/problem/1546๐Ÿ“Œ์œ ํ˜•์ˆ˜ํ•™, ์‚ฌ์น™์—ฐ์‚ฐโœ๐Ÿปํ’€์ดA, B, C๋ผ๋Š” ์ ์ˆ˜๊ฐ€ ์žˆ๋‹ค๋ฉด(A/M*100 + B/M*100 + C/M*100)/3์€ ๊ฒฐํ•ฉ๋ฒ•์น™์— ์˜ํ•ด (A+B+C)*100/M/3๊ณผ ๊ฐ™๋‹ค๊ทธ๋Ÿฌ๋ฏ€๋กœ ๋จผ์ € ์ ์ˆ˜์˜ ํ•ฉ์„ ๊ตฌํ•˜๊ณ  ๊ทธ์™€ ๋™์‹œ์— ์ตœ๋Œ“๊ฐ’๋„ ๊ตฌํ•œ๋‹ค.๐Ÿ’ป์ฝ”๋“œimport java.util.*;public class Main { static int n; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); float[] score = new float[n]; for (int i =.. 2024. 9. 28.
728x90
๋ฐ˜์‘ํ˜•