Algorithm 16

[BOJ] 2839 설탕 배달

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BOJ2839 { class Program { static void Main(string[] args) { // 입력 받는 무게 int input = int.Parse(Console.ReadLine()); // 봉지 갯수 int count = 0; // while문으로 input값이 0보다 클때까지 반복 // - 루프 한번이 돌면 input에는 계산된 나머지가 계속 남게됨. 나머지 값을 계속 체크해주는 것 // - 1. 3의 배수인지 5의 배수인지 체크 // - 2. 두 경우가 아니..

Algorithm/BOJ 2023.01.25

[BOJ] 5585 거스름돈

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HW0116 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); //물건 값 입력 int r = 1000 - n; //거스름돈 계산 //여기부터 작성 하세요 int[] change = { 500, 100, 50, 10, 5, 1 }; //동전 종류 int coinCount = 0; //동전 개수 for (int i = 0; i < change.Length; i++) //값이..

Algorithm/BOJ 2023.01.17

[BOJ] 11720 숫자의 합

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Homework1 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); //숫자의 개수 string strnum = Console.ReadLine(); //N개의 숫자 나열 //여기서 부터 작성하세요 int sum = 0; for (int i = 0; i < N; i++) { //배열에서 꺼낸 문자는 char이므로 Tostring()을 통해 문자열로 바꿔주고 다시 정수로 변환..

Algorithm/BOJ 2023.01.15