반응형 [C#]프로그래머스/1단계3 최대공약수와 최소공배수 public class Solution { public int[] solution(int n, int m) { int max; int min; int[] answer = new int[2]; max = n * m / GCD(n, m); min = GCD(n, m); answer = new int[] { min, max }; return answer; } int GCD(int a, int b) { return b == 0 ? a : GCD(b, a % b); } } 2023. 2. 14. 2016년 public class Solution { public int numA; public int numC; public string solution(int a, int b) { string answer = ""; switch (a) { case 1: numA = 0; break; case 2: numA = 31; break; case 3: numA = 31 + 29; break; case 4: numA = 31 + 29 + 31; break; case 5: numA = 31 + 29 + 31 + 30; break; case 6: numA = 31 + 29 + 31 + 30 + 31; break; case 7: numA = 31 + 29 + 31 + 30 + 31 + 30; break; case 8: numA.. 2023. 2. 14. 성격 유형 검사하기(2022 KAKAO TECH INTERNSHIP) using System; public class Solution { public string solution(string[] survey, int[] choices) { string answer = ""; int r = 0; int t = 0; int c = 0; int f = 0; int j = 0; int m = 0; int a = 0; int n = 0; for(int i = 0; i=4) { switch (choices[i]) { case 4: break; case 5: t +=1; break; case 6: t +=2; break; case 7: t +=3; break; } } else { switch (choices[i]) { case 1: r+=3; break; case 2: r+=2; br.. 2023. 2. 14. 이전 1 다음 반응형