#프로그래머스 #c #코딩테스트 13

[프로그래머스,C#] 피자 나눠 먹기(1)

머쓱이네 피자가게는 피자를 일곱 조각으로 잘라 줍니다. 피자를 나눠먹을 사람의 수 n이 주어질 때, 모든 사람이 피자를 한 조각 이상 먹기 위해 필요한 피자의 수를 return 하는 solution 함수를 완성해보세요. public int solution(int n) { int answer = 0; int people = Math.Clamp(n,0,100); if(people % 7 == 0) { return n / 7; } else{ return (n / 7) +1; } return answer; }

코딩문제 2025.02.12

[프로그래머스,C#] 배열 두 배 만들기

정수 배열 numbers가 매개변수로 주어집니다. numbers의 각 원소에 두배한 원소를 가진 배열을 return하도록 solution 함수를 완성해주세요. ▼ 첫번째 풀이 public int[] solution(int[] numbers) { int[] answer = new int[numbers.Length]; for(int i =0;i  ▼ 두번째 풀이 (Linq.Select()를 써서한 경우)using System.Linq; // 안쓰면 에러가 난다 중요!!!public class Solution { public int[] solution(int[] numbers) { int[] answer = numbers.Sel..

코딩문제 2025.02.10