본문 바로가기
728x90

백준107

[BOJ C#, C++ ] 1000 A+B, 1001 A-B, 10998 AxB 백준을 프로젝트 기간동안 하지 못해서 어떻게 기본 폼을 만들었는지 조차 가물가물했다. 연습하며 왕초보 문제들부터 최소 하루에 1~2개씩은 풀 예정이다. 왕초보부터 풀어가며 c++로 같이 연습 할 예정이다. +) c++로 풀이한 답을 보며 공부하던 중에, 한 블로그에서 stdio.h와 iostream확장자의 성능을 각각 비교하는 글이 있어 궁금하여 찾아보았다. 2023.07.11 - [분류 전체보기] - [ C++ ] stdio.h와 iostream의 차이 [ C++ ] stdio.h와 iostream의 차이 백준을 위해 C#에서 C++로 넘어가며 답을 비교하며 공부하던 중에, 한 블로그에 stdio.h와 iostream 헤더파일의 성능을 비교하는 글을 보았다. 처음 C++을 공부하였기 때문에 어떤 확장자.. 2023. 7. 11.
[BOJ C#] 10808 알파벳 개수 using System; namespace _10808 { class Program { static void Main() { string input = Console.ReadLine(); int[] output = new int[26]; for(int i = 0; i < input.Length; i++) { int a = input[i] - 'a'; output[a]++; } foreach(int n in output) { Console.Write("{0} ", n); } } } } 2023. 3. 14.
[BOJ C#] 1439 뒤집기 중간에 count 확인하려 출력했던 코드를 안지워서 틀렸다..실제로는 이런 실수 안하도록 조심하기!! using System; namespace _1439 { class Program { static void Main() { string str = Console.ReadLine(); int n; int count0 = 0; int count1 = 0; if (str[0] == '0') { n = 0; count0++; } else { n = 1; count1++; } for (int i = 1; i < str.Length; i++) { if (str[i-1] == '0' && str[i] == '1') { n = 1; count1++; } else if (str[i-1] == '1' && str[i] =.. 2023. 1. 28.
[BOJ C#] 5585 거스름돈 using System; namespace _5585 { class Program { static void Main() { int price = int.Parse(Console.ReadLine()); int charge = 1000 - price; int count = 0; while (charge > 0) { if (charge >= 500) { count += (charge / 500); charge %= 500; } else if (charge >= 100) { count += (charge / 100); charge %= 100; } else if (charge >= 50) { count += (charge / 50); charge %= 50; } else if (charge >= 10) { co.. 2023. 1. 27.
[BOJ C#] 1259 팰린드롬수 using System; using System.Linq; using System.Text; using System.IO; namespace _1259 { class Program { static void Main() { StreamReader sr = new StreamReader(Console.OpenStandardInput()); StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()); StringBuilder sb = new StringBuilder(); while (true) { string str = sr.ReadLine(); if (str == "0") break; string strReverse = new string(str.Re.. 2023. 1. 26.
[BOJ C#] 1085 직사각형에서 탈출 using System; using System.IO; namespace _1085 { class Program { static void Main() { StreamReader sr = new StreamReader(Console.OpenStandardInput()); StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()); string[] arrString = sr.ReadLine().Split(' '); int x = int.Parse(arrString[0]); int y = int.Parse(arrString[1]); int w = int.Parse(arrString[2]); int h = int.Parse(arrString[3]); in.. 2023. 1. 25.
728x90