코딩 테스트 13

[C#] 백준 알고리즘 - 설탕 배달

문제 : 백준 알고리즘 2839번 문제 https://www.acmicpc.net/problem/2839 2839번: 설탕 배달 상근이는 요즘 설탕공장에서 설탕을 배달하고 있다. 상근이는 지금 사탕가게에 설탕을 정확하게 N킬로그램을 배달해야 한다. 설탕공장에서 만드는 설탕은 봉지에 담겨져 있다. 봉지는 3킬로그 www.acmicpc.net 풀이 : // Input int input = int.Parse(ReadLien()); // 설탕 int count = -1; // 봉지 개수 // Processing while (input > 0) { if (input % 5 == 0) { input -= 5; Count++; } else if (input % 3 == 0) { input -= 3; Count++; ..

[C#] 프로그래머스 알고리즘 - 숫자 정렬

문제 : 프로그래머스 https://programmers.co.kr/skill_checks/369129?challenge_id=947 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이 : using System; using System.Collections.Generic; using System.Linq; public class Solution { public long solution(long n) { long answer = 0; char[] a = n.ToString().ToCharArray(); Array.Sort(a); Array.Reverse(..

[Python] - Coding Test / 6097 문제

✍ CodeUp 문제 / 출처 : Codeup 👉 Input → 👉 Output → 👉 Source Code h, w = map(int, input().split()) n = int(input()) grid = [list(0 for _ in range(w)) for _ in range(h)] for i in range(n): l , d, x, y = map(int, input().split()) x -= 1 y -= 1 # 가로 if d == 0: for j in range(l): grid[x][y + j] = 1 else: for j in range(l): grid[x + j][y] = 1 for i in range(h): print(*grid[i]) # * 연산자 사용하여 list 형태 없애고 1개씩..