본문 바로가기
코딩테스트/LV. 0

LV. 0 :: 피자 나눠 먹기 3

by KUROMI98 2023. 1. 20.

https://school.programmers.co.kr/learn/courses/30/lessons/120816

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

function solution(slice, n) {
    var answer = 0;
    answer = Math.ceil(n/slice);
    return answer;
}

+) 230509

const solution = (slice, n) => {
    return Math.ceil(n/slice);
}

230525 파이썬으로 다시 풀이

import math
def solution(slice, n): 
    return math.ceil(n/slice)

230915 C++

#include <string>
#include <vector>

using namespace std;

int solution(int slice, int n) {
    int answer = n/slice;
    if(n%slice!=0){
        answer=answer+1;
    }
    return answer;
}

'코딩테스트 > LV. 0' 카테고리의 다른 글

LV. 0 :: 삼각형의 완성조건  (0) 2023.01.20
LV. 1 :: 피자 나눠 먹기 1  (0) 2023.01.20
LV. 0 :: 배열 뒤집기  (0) 2023.01.20
LV. 0 :: 배열 원소의 길이  (0) 2023.01.20
LV. 0 :: 아이스 아메리카노  (0) 2023.01.20

댓글