본문 바로가기
728x90

BOJ109

[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#] 4796 캠핑 처음에 쉬워보여서 구조 자체는 빨리 짰지만 함정이 있던 문제. +오타, \n 조심 using System; using System.Text; using System.IO; namespace _4796 { class Program { static void Main() { StreamReader sr = new StreamReader(Console.OpenStandardInput()); StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()); StringBuilder sb = new StringBuilder(); int caseN = 0; int result = 0; while (true) { if (caseN > 0) { sb.AppendForm.. 2023. 2. 1.
[BOJ C#] 10162 전자레인지 using System; namespace _10162 { class Program { static void Main(string[] args) { int a = 300; int b = 60; int c = 10; int t = int.Parse(Console.ReadLine()); if (t % 10 != 0) Console.WriteLine("-1"); else { int clickA = t / a; t = t % a; int clickB = t / b; t = t % b; int clickC = t / c; Console.WriteLine("{0} {1} {2}", clickA, clickB, clickC); } } } } 2023. 1. 31.
[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.
728x90