[알고리즘] 2차원 배열을 이용하여 해당 년도의 월 일을 입력하면 해당년도부터 며칠 째인지 알려주는 프로그램
2차원 배열을 이용하여 해당 년도의 월 일을 입력하면 해당년도부터 며칠 째인지 알려주는 프로그램 using System; using System.Diagnostics; using System.Text; namespace ConsoleApp4 { class Program { public static int[,] mdays =new int[,] { { 31,28,31,30,31,30,31,31,30,31,30,31}, //평년 { 31,29,31,30,31,30,31,31,30,31,30,31} //윤년 }; //해당 년도는 윤년인가?(윤년 true / 평년 false) static int isLeap(int year) { return (year % 4 == 0 && year % 100 != 0 || yea..
2020. 4. 12.
[알고리즘] 프로그래머스 Level1 - 모의고사
using System; using System.Collections.Generic; public class Solution { public int[] solution(int[] answers) { int[] answer = new int[] {}; int [] people_1 = new int[]{1,2,3,4,5}; int [] people_2 = new int[]{2,1,2,3,2,4,2,5}; int [] people_3 = new int[]{3,3,1,1,2,2,4,4,5,5}; int [] cnt = new int[]{0,0,0}; for(int i=0;i
2020. 3. 24.