c# 49

백준 2720번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //입력횟수 받아올 변수 int count = int.Parse(Console.ReadLine()); //결과값 넣을 이차원배열 int[,] result = new int[count, 4]; //조건에서 입력값으로 주는 거스름돈의 단위는 소수점이 없는 센트라고 했다 //이 경우 쿼터, 다임, 니켈, 페니 역시 소수점을 없애주면 계산이 쉬워진다. int quarter = 25; int dime = 10;..

백준 2024.01.25

백준 11005번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //입력값 받아옴 string[] input = Console.ReadLine().Split(); //입력값 첫번째는 10진수 변수에 저장 int decimalNum = int.Parse(input[0]); //입력값 두번째는 변환할 n진수 변수에 저장 int convertBaseNum = int.Parse(input[1]); //10진수를 n진수로 변환하는 메소드 실행, 동시에 반환값 받고 출력 Co..

백준 2024.01.25

백준 2745번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //입력값 받아옴 string input = Console.ReadLine(); // 입력값을 공백으로 분리 string[] inputParts = input.Split(' '); // 입력값이 충분한지 확인 if (inputParts.Length == 2) { string number = inputParts[0]; //몇 진수인지 받아올 변수 int baseFrom; // 진법을 정수로 파싱, 이후 ..

백준 2024.01.24

백준 2563번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //이 문제를 풀때 좌표를 생각하기로 하자 //왼쪽 맨 아래 지점이 0,0임 //이 기준으로 100 x 100 칸의 bool형의 이차원배열을 만들어 사용할거임 //검은색종이가 해당되는 곳은 true이고 아닌 곳은 false임 //검은색종이를 넣을 수 int count = int.Parse(Console.ReadLine()); //검은 색종이 위치를 넣을 임시변수 string[] input; //하얀도화..

백준 2024.01.23

백준 10798번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //내 입력값 넣을 변수 string input = ""; //결과값을 넣을 변수 string result = ""; //조건은 5행 고정이고 열은 최대 15열임 //형은 char임 char[,] box = new char[5,15]; //내 입력값을 총 5번 받을거임 for (int i = 0; i < 5; i++) { //input변수에 임시로 내 입력값 저장해줌 input = Console.Rea..

백준 2024.01.22

백준 2566번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //최댓값 넣을 변수 int big = 0; //최댓값의 이차원배열 위치를 넣을 변수 string bigIndex = ""; //내 입력값 넣을 이차원배열 변수 int[,] box = new int[9,9]; //내가 한줄씩 입력값 넣을때마다 쓸, 임시 배열 변수 //배열의 크기는 9x9임 string[] temp = new string[9]; //행의 수만큼 반복 for (int i = 0; i < ..

백준 2024.01.22

백준 2738번 c#

using System; using System.Text; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //내 입력값(행과 열) 받아올 변수배열 string[] input = Console.ReadLine().Split(); //입력값 input 배열에서 행과 열을 저장한다 int row = int.Parse(input[0]); int column = int.Parse(input[1]); //내가 입력한 행과 열 값으로 2차원배열을 생성한다 //2차원배열 변수를 총2개 ..

백준 2024.01.21

백준 25206번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //입력값 한줄 받아올 배열변수 string[] input; //현재 확인중인 과목의 과목평점(A+등급등을 4.5로 변환한거) 담을 변수 float gradeScore = 0f; //현재 확인중인 과목의 학점 담을 변수 float currentCredit = 0f; //내가 수강한 과목의 총학점 담을 변수 float totalCredit = 0f; //현재 확인중인 과목 학점 * 그 과목의 과목평점 결..

백준 2024.01.18

백준 1316번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //이 문제는 앞에서 나왔던 알파벳이 연속적으로만 나오면 되는걸 찾으면 된다. //근데 난 그룹 단어 조건에 안맞는 틀린 글자를 찾아낼거임 //입력할 단어의 개수 int count = int.Parse(Console.ReadLine()); //입력한 단어를 저장할 변수 string input = ""; //결과값 넣을 변수(일단 모두 정답인 그룹단어라고 치고 count 값을 result에 대입함) in..

백준 2024.01.17

백준 2941번 c#

using System; namespace Baekjoon { internal class Program { static void Main(string[] args) { //이 코드의 규칙 //1. 특수문자는 카운트 하지 않음 //2. z일때 그전 글자가 d인지, 그다음 글자가 =인지 확인(만약 조건 부합하면 카운트 하지 않음) //3. j일때 그전 글자가 l혹은 n인지, 그다음 글자가 =인지 확인(만약 조건 부합하면 카운트 하지 않음) //소문자 a~z는 아스키코드 97~122임 //그냥 콘솔창 예쁘게 꾸미는 코드(심심해서 넣음) Console.BackgroundColor = ConsoleColor.DarkCyan; //내 입력값 받아올 변수 string input = Console.ReadLine();..

백준 2024.01.17