전체 글(771)
-
[파이썬] 완전범죄
https://school.programmers.co.kr/learn/courses/30/lessons/389480 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport sysfrom functools import lru_cachesys.setrecursionlimit(10**8)def solution(info, n, m): answer = dfs(0, tuple(map(tuple, info)), 0, 0, n, m) return answer if answer != 222 else -1@lru_cache(None)def dfs(depth, info, a, b, n, m): if a >= n ..
2025.12.06 -
[파이썬] 서버 증설 횟수
https://school.programmers.co.kr/learn/courses/30/lessons/389479import heapqdef solution(players, m, k): answer = 0 cnt = 0 cur_server = 0 end = [] time = 0 for player in players: while end: if time >= end[0][0]: ele = heapq.heappop(end) cur_server -= ele[1] else: break add = 0 if player // ..
2025.12.06 -
[파이썬] 퍼즐 조각 채우기
https://school.programmers.co.kr/learn/courses/30/lessons/84021 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr import syssys.setrecursionlimit(10**6)from collections import dequefrom collections import defaultdictdef solution(game_board, table): answer = 0 cnt = 2 for i in range(len(table)): for j in range(len(table[0])): if table[i][j] ..
2025.12.03 -
[Java][X] 다각형의 면적
https://www.acmicpc.net/problem/2166import java.io.*;import java.util.*;class Main { static int N; static int[][] polygon; static double[] center; static double area; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); N = Integer.parseInt(br.readLine()); polygon = new int[N+1][2]; center = new double[2]; area..
2025.01.22 -
[Java] double, float을 println으로 찍게 되면
값이 작으면 그대로 출력이 되지만값이 커지면 지수표기법이 사용된다.예를 들어, 다음과 같다.39999999999.5 => 3.99999999995E10이를 지수표기법을 사용하지 않고 찍고 싶다면 다음의 경우들로 가능하다.아래 경우 모두 다 마지막 자리에 맞춰 반올림을 해준다.1. System.out.printfSystem.out.println("printf");System.out.printf("%.1f%n", area);2. DecimalFormatimport java.text.DecimalFormat;System.out.println("DecimalFormat");DecimalFormat df = new DecimalFormat("#.#");System.out.println(df.format(area)..
2025.01.22 -
[알고리즘] 특별한 물리 공격
https://www.acmicpc.net/problem/31675import java.io.*;import java.util.*;class Main { static int N; static long[] R; static long[][][] dp; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); N = Integer.parseInt(br.readLine()); R = new long[N + 1]; dp = new long[N + 1][2][2]; StringTokenizer st =..
2025.01.16