업로드중..일단 첫번째 도시에선 무조건 주유를 해야한다. (그래야 두번째 도시에 갈 수 있음) cost\[0]\*distance\[0] 를 더해야야한다.기름 값이 가장 저렴한 도시에서 최대한 많이 주유해야한다. 아무리 기름 값이 싼 도시가 나와도, 그 전까진 약간 비싼
기다리는 시간의 합을 최소화하는 문제 1. 문제 2. 아이디어 3. 코드
N\*N 크기의 행렬(1,1) -> (N,N)1) 데이터 입력 받기 2) i와 j로 좌표 표현3) if 문으로 i와 j를 감소/증가 시키는데, 케이스에 따라 무시하는 경우 고려 나는 단순하고 간단하게 구현했다. 굳이 이렇게 복잡하게 구현해야되나 싶긴 한데... 그래도
정수 N이 입력되면 00시 00분 00초부터 N시 59분 59초까지의 모든 시각 중에서 3이 하나라도 포함되는 모든 경우의 수를 구하는 프로그램을 작성하시오. 각 시, 분, 초에서 숫자 3이 들어가는 경우의 수를 구하고3포함이 1번인 경우, 2번인 경우, 3번인 경우를
왕실의 나이트문제행복 왕국의 왕실 정원은 체스판과 같은 8 × 8 좌표 평면이다. 왕실 정원의 특정한 한 칸에 나이트가 서있다.나이트는 매우 충성스러운 신하로서 매일 무술을 연마한다나이트는 말을 타고 있기 때문에 이동을 할 때는 L자 형태로만 이동할 수 있으며 정원 밖
현민이는 게임 캐릭터가 맵 안에서 움직이는 시스템을 개발 중이다. 캐릭터가 있는 장소는 1 X 1 크기의 정사각형으로 이뤄진 N X M 크기의 직사각형으로, 각각의 칸은 육지 또는 바다이다. 캐릭터는 동서남북 중 한 곳을 바라본다.맵의 각 칸은 (A, B)로 나타낼 수
1. 문제 2. 내 아이디어 N과 M 저장 후, 둘 중 더 작은 값을 s에 저장 찾은 정사각형은 아무리 커도 한 변이 s보다 클 수 없다 정사각형을 2차원 배열에 저장하기 만약 s가 3이라면? 한 변의 길이가 3, 2, 1인 순으로 탐색하기 발견한다면 그 값의 제
1. 문제 https://www.acmicpc.net/problem/1063 2. 나의 아이디어 움직이는 경우의 수 8가지에 대한 dx와 dy를 정한다. 3. 나의 코드
아래 그림을 참고하면 더 이해가 쉽다.이 문제는 평년 기준으로 생각하기보다 윤년을 기준으로 생각하는 것이 더 이해하기 쉽다. 윤년은 4의 배수 중100의 배수를 제외400의 배수는 포함으로 나타 낼 수 있고, 윤년을 제외하면 모두 평년이다.그러므로 평년이 되는 조건은4