ComputerScience/Coding Test

    C# 백준 4101번: 크냐?

    using System; class Program { static void Main(string[] args) { List listA = new List(); List listB = new List(); while (true) { string stringInput = Console.ReadLine(); string[] stringInputArray = stringInput.Split(' ', StringSplitOptions.None); int A = Convert.ToInt32(stringInputArray[0]); int B = Convert.ToInt32(stringInputArray[1]); if (A == 0 && B == 0) { break; } listA.Add(A); listB.Add(B)..

    C# 백준 2738번: 행렬 덧셈

    using System; class Program { static void Main(string[] args) { string stringN = Console.ReadLine(); string[] stringArray = stringN.Split(' ', StringSplitOptions.None); int Y = Convert.ToInt32(stringArray[0]); int X = Convert.ToInt32(stringArray[1]); int[,] matrixA = new int[Y,X]; for (int i = 0; i < Y; i++) { string s = Console.ReadLine(); string[] sArray = s.Split(' ', StringSplitOptions.None)..

    C# 백준 10872번: 팩토리얼

    using System; class Program { static void Main(string[] args) { string stringN = Console.ReadLine(); int intN = Convert.ToInt32(stringN); int factorial = 1; for (int i = 1; i

    C# 백준 5522번: 카드 게임

    using System; class Program { static void Main(string[] args) { int total = 0; for (int i = 0; i < 5; i++) { string stringN = Console.ReadLine(); int intN = Convert.ToInt32(stringN); total += intN; } Console.WriteLine(total); } } 문제 출처 https://www.acmicpc.net/problem/5522 5522번: 카드 게임 JOI군은 카드 게임을 하고 있다. 이 카드 게임은 5회의 게임으로 진행되며, 그 총점으로 승부를 하는 게임이다. JOI군의 각 게임의 득점을 나타내는 정수가 주어졌을 때, JOI군의 총점을 구하는 프..

    C# 백준 25372번: 성택이의 은밀한 비밀번호

    using System; using System.Numerics; class Program { static void Main(string[] args) { string stringNumber = Console.ReadLine(); int number = int.Parse(stringNumber); for (int i = 0; i < number; i++) { string stringPassword = Console.ReadLine(); if (5 < stringPassword.Length && stringPassword.Length < 10) { Console.WriteLine("yes"); } else { Console.WriteLine("no"); } } } } 문제 출처 https://www.acm..

    C# 백준 2338번: 긴자리 계산

    using System; using System.Numerics; class Program { static void Main(string[] args) { string stringA = Console.ReadLine(); string stringB = Console.ReadLine(); BigInteger A = BigInteger.Parse(stringA); BigInteger B = BigInteger.Parse(stringB); Console.WriteLine(A + B); Console.WriteLine(A - B); Console.WriteLine(A * B); } } 문제 출처 https://www.acmicpc.net/problem/2338 2338번: 긴자리 계산 첫째 줄에 A+B, 둘째 ..

    C# 백준 1271번: 엄청난 부자2

    using System; using System.Numerics; class Program { static void Main(string[] args) { string stringInput = Console.ReadLine(); string[] arrayStrings = stringInput.Split(' ', StringSplitOptions.None); BigInteger N = BigInteger.Parse(arrayStrings[0]); BigInteger M = BigInteger.Parse(arrayStrings[1]); BigInteger divided = N / M; BigInteger remained = N % M; Console.WriteLine(divided); Console.Writ..

    C# 백준 10757번: 큰 수 A + B

    using System; using System.Numerics; class Program { static void Main(string[] args) { string stringInput = Console.ReadLine(); string[] arrayStrings = stringInput.Split(' ', StringSplitOptions.None); BigInteger A = BigInteger.Parse(arrayStrings[0]); BigInteger B = BigInteger.Parse(arrayStrings[1]); Console.WriteLine(A + B); } } 문제 출처 https://www.acmicpc.net/problem/10757 10757번: 큰 수 A+B 두 정수 A와..

    백준 2420번: 사파리월드

    using System; class Program { static void Main(string[] args) { string stringInput = Console.ReadLine(); string[] array = stringInput.Split(' ', StringSplitOptions.None); long a = System.Convert.ToInt64(array[0]); long b = System.Convert.ToInt64(array[1]); long result = 0; if (a < b) { result = b - a; } else { result = a - b; } result = Math.Abs(result); Console.WriteLine(result); } } 문제 출처 http..

    백준 11382번: 꼬마 정민

    using System; class Program { static void Main(string[] args) { string stringInput = Console.ReadLine(); string[] arrayInput = stringInput.Split(' ', StringSplitOptions.None); long[] intResult = new long[3] {0, 0, 0}; for (int i = 0; i < 3; i++) { intResult[i] = System.Convert.ToInt64(arrayInput[i]); } long total = 0; for (int i = 0; i < 3; i++) { total += intResult[i]; } Console.WriteLine(total..

    백준 9086번: 문자열

    using System; class Program { static void Main(string[] args) { string stringNumber = Console.ReadLine(); int intNumber = System.Convert.ToInt32(stringNumber); string[] result = new string[intNumber]; for (int i = 0; i < intNumber; i++) { string testCase = Console.ReadLine(); char[] array = testCase.ToCharArray(); result[i] = array[0].ToString() + array[array.Length - 1].ToString(); } foreach (s..

    백준 11718번: 그대로 출력하기

    using System; class Program { static void Main(string[] args) { while (true) { string input = Console.ReadLine(); if (string.IsNullOrEmpty(input) == true) break; Console.WriteLine(input); } } } 문제 출처 https://www.acmicpc.net/problem/11718 11718번: 그대로 출력하기 입력이 주어진다. 입력은 최대 100줄로 이루어져 있고, 알파벳 소문자, 대문자, 공백, 숫자로만 이루어져 있다. 각 줄은 100글자를 넘지 않으며, 빈 줄은 주어지지 않는다. 또, 각 줄은 공백으로 시 www.acmicpc.net

    백준 2754번: 학점계산

    using System; class Program { static void Main(string[] args) { string stringScore = Console.ReadLine(); float score = 0; switch (stringScore) { case "A+": score = 4.3f; break; case "A0": score = 4.0f; break; case "A-": score = 3.7f; break; case "B+": score = 3.3f; break; case "B0": score = 3.0f; break; case "B-": score = 2.7f; break; case "C+": score = 2.3f; break; case "C0": score = 2.0f; brea..

    백준 2744번: 대소문자 바꾸기

    using System; class Program { static void Main(string[] args) { string word = Console.ReadLine(); char[] wordArray = word.ToCharArray(); string result = ""; foreach (char c in wordArray) { if (Char.IsLower(c) == true) { string s = c.ToString().ToUpper(); result += s; } else if (Char.IsUpper(c) == true) { string s = c.ToString().ToLower(); result += s; } } Console.WriteLine(result); } } 문제 출처 htt..

    백준 2743번: 단어 길이 재기

    using System; class Program { static void Main(string[] args) { string word = Console.ReadLine(); Console.WriteLine(word.Length); } } 문제 출처 https://www.acmicpc.net/problem/2743 2743번: 단어 길이 재기 알파벳으로만 이루어진 단어를 입력받아, 그 길이를 출력하는 프로그램을 작성하시오. www.acmicpc.net

    백준 11654번: 아스키 코드

    using System; class Program { static void Main(string[] args) { string ascii = Console.ReadLine(); char[] c = ascii.ToCharArray(); int code = (int)c[0]; Console.WriteLine(code); } } 문제 출처 https://www.acmicpc.net/problem/11654 11654번: 아스키 코드 알파벳 소문자, 대문자, 숫자 0-9중 하나가 주어졌을 때, 주어진 글자의 아스키 코드값을 출력하는 프로그램을 작성하시오. www.acmicpc.net