'Goorm ide 코딩 문제'에 해당되는 글 18건

1. ASCII 코드 

만든이 : 웃긴 구이

 

2. 문제정보

level.goorm.io/exam/43208/ascii-%EC%BD%94%EB%93%9C/quiz/1

 

구름LEVEL

코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이

level.goorm.io

3. 풀이

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
user_input = input()
print(ord(user_input)) '''ord 함수 사용'''

 

 

4. 결과

시간 :  0.0 s

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
value, dv  = map(int, input().split())
share = 0 
while (value >= dv):
	value -= dv
	share += 1
print(share, value)
	

'Goorm ide 코딩 문제 > Level 1' 카테고리의 다른 글

[Goorm LEVEL 1] 세로 순서 사각형  (0) 2021.04.13
[Goorm LEVEL 1] 윤년 (Leap Year)  (0) 2021.04.13
[Goorm LEVEL 1] 몫과 나머지  (0) 2021.04.13
[Goorm LEVEL 1] 16진수  (0) 2021.04.13
[Goorm LEVEL 1] 거스름돈  (0) 2021.04.13
블로그 이미지

Or71nH

,

1. 몫과 나머지 

만든이 : 슬픈 찜닭

 

2. 문제정보

level.goorm.io/exam/43222/%EB%AA%AB%EA%B3%BC-%EB%82%98%EB%A8%B8%EC%A7%80/quiz/1

 

구름LEVEL

코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이

level.goorm.io

 

3. 풀이

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
value, dv  = map(int, input().split())
share = 0 
while (value >= dv): '''뺴지면 무한 반복 '''
	value -= dv
	share += 1
    
print(share, value)
	

 

 

4. 결과

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
value, dv  = map(int, input().split())
share = 0 
while (value >= dv):
	value -= dv
	share += 1
print(share, value)
	

'Goorm ide 코딩 문제 > Level 1' 카테고리의 다른 글

[Goorm LEVEL 1] 윤년 (Leap Year)  (0) 2021.04.13
[Goorm LEVEL 1] ASCII 코드  (0) 2021.04.13
[Goorm LEVEL 1] 16진수  (0) 2021.04.13
[Goorm LEVEL 1] 거스름돈  (0) 2021.04.13
[Goorm LEVEL 1] Bubble Sort  (0) 2021.04.12
블로그 이미지

Or71nH

,

1. 16진수

만든이 : 웃긴 전골

 

2. 문제정보

level.goorm.io/exam/43226/16%EC%A7%84%EC%88%98/quiz/1

 

구름LEVEL

코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이

level.goorm.io

3. 풀이

1. 2진수로 전환하는 과정이 필요하기에 전환을 한다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
	
user_input = int(input())
bit2 = []
count = 0
num = 0 
bit16 = []

while user_input: ''' 없어질때까지 홀수면 1을 빼서 2로 나눠준다 아니면 그냥 나눈다'''
	if user_input % 2 == 1:
		user_input -= 1
		bit2.append(1)
	else:
		bit2.append(0)
	user_input /= 2

2. 16진수로 전환을 하자

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
def numbering16(number):
	numberdir = {10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f'}
	if number >= 10 :
		return numberdir[number]
	else:
		return number
	
user_input = int(input())
bit2 = []
count = 0
num = 0 
bit16 = []
while user_input:
	if user_input % 2 == 1:
		user_input -= 1
		bit2.append(1)
	else:
		bit2.append(0)
	user_input /= 2

for i in bit2:   ''' 진수에 맞게 재곱하여 더하여 넣어준다 '''
	num += i*2**count ''' 2를 자리에 맞게 재곱하고 비트에 숫자가 있으면 1 이되어 합쳐지고 아니면 0 이되여 더할게없다'''
	
	if count == 3 :   ''' 2에 3승까지 가면 16진수니깐 값을 저장하고 0으로 되돌린다'''
		bit16.append(num)  
		count = 0
		num = 0
	else:
		count += 1
if count != 0:   '''  마즈막에 0 이 아닐경우 num 값이 입력되지않고 남아있기에 넣어주고 끝넨다'''
	bit16.append(num)  

3. 10이상의 숫자를 문자로 변환하고 출력하자

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean


def numbering16(number):        ''' 숫자를 문자로 전환해주는 딕션너리 함수를 만든다 '''
	numberdir = {10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f'}
	if number >= 10 :   '''10 보다 클때만 적으면된다 '''
		return numberdir[number]
	else:
		return number
	
user_input = int(input())
bit2 = []
count = 0
num = 0 
bit16 = []
while user_input:
	if user_input % 2 == 1:
		user_input -= 1
		bit2.append(1)
	else:
		bit2.append(0)
	user_input /= 2

for i in bit2:
	num += i*2**count
	
	if count == 3 :
		bit16.append(num)
		count = 0
		num = 0
	else:
		count += 1
if count != 0:
	bit16.append(num)

for i in list(reversed(bit16)):   
	print(numbering16(i),end="") ''' 함수를 불러 형식에 맞게 출력한다'''

4. 결과

1. 위 풀이의 결과다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
def numbering16(number):
	numberdir = {10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f'}
	if number >= 10 :
		return numberdir[number]
	else:
		return number
	
user_input = int(input())
bit2 = []
count = 0
num = 0 
bit16 = []
while user_input:
	if user_input % 2 == 1:
		user_input -= 1
		bit2.append(1)
	else:
		bit2.append(0)
	user_input /= 2

for i in bit2:
	num += i*2**count
	
	if count == 3 :
		bit16.append(num)
		count = 0
		num = 0
	else:
		count += 1
if count != 0:
	bit16.append(num)

for i in list(reversed(bit16)):
	print(numbering16(i),end="")

2. hex 함수를 사용하여 편하게 작성 하는 방법이다 

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean

user_input = hex(int(input()))
print(user_input.replace("0x",""))

 

'Goorm ide 코딩 문제 > Level 1' 카테고리의 다른 글

[Goorm LEVEL 1] ASCII 코드  (0) 2021.04.13
[Goorm LEVEL 1] 몫과 나머지  (0) 2021.04.13
[Goorm LEVEL 1] 거스름돈  (0) 2021.04.13
[Goorm LEVEL 1] Bubble Sort  (0) 2021.04.12
[Goorm LEVEL 1] 삼각형의 넓이  (0) 2021.04.12
블로그 이미지

Or71nH

,

1. 거스름돈

만든이 : 심심한 구이

 

2. 문제정보

level.goorm.io/exam/43242/%EA%B1%B0%EC%8A%A4%EB%A6%84%EB%8F%88/quiz/1

 

구름LEVEL

코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이

level.goorm.io

3. 풀이

1. 코인을 만들어 준다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
user_input = 1000 - int(input()) '''거스름돈'''
coin500 = 0
coin100 = 0
coin50 = 0
coin10 = 0  

2.  큰코인부터 하나씩 넣어주며 다시돌린다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
user_input = 1000 - int(input())
coin500 = 0
coin100 = 0
coin50 = 0
coin10 = 0

''' 이제 코인을 높은수부터 넣으며 한코인이 들어갈때마다 다시 높은수부터 코인을 넣어 작은동전을 먼저넣을것을 예방한다'''
while user_input:
	if user_input >= 500:
		user_input -= 500
		coin500 += 1
		continue
	elif user_input >= 100:
		user_input -= 100
		coin100 += 1
		continue
	elif user_input >= 50:
		user_input -= 50
		coin50 += 1
		continue
	else:
		user_input -= 10
		coin10 += 1

3. 출력을 맞쳐준다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
user_input = 1000 - int(input())
coin500 = 0
coin100 = 0
coin50 = 0
coin10 = 0

while user_input:
	if user_input >= 500:
		user_input -= 500
		coin500 += 1
		continue
	elif user_input >= 100:
		user_input -= 100
		coin100 += 1
		continue
	elif user_input >= 50:
		user_input -= 50
		coin50 += 1
		continue
	else:
		user_input -= 10
		coin10 += 1
''' 출력을 맞쳐준다 '''
print(coin500,end=" ")
print(coin100,end=" ")
print(coin50,end=" ")
print(coin10,end=" ")

 

 

4. 결과

좀더 깔끔하게 보이게 변경하였다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
user_input = 1000 - int(input())
coin = [0,0,0,0]

while user_input:
	if user_input >= 500:
		user_input -= 500
		coin[0] += 1
		continue
	elif user_input >= 100:
		user_input -= 100
		coin[1] += 1
		continue
	elif user_input >= 50:
		user_input -= 50
		coin[2] += 1
		continue
	else:
		user_input -= 10
		coin[3] += 1

for i in coin:
	print(i,end=" ")

 

'Goorm ide 코딩 문제 > Level 1' 카테고리의 다른 글

[Goorm LEVEL 1] 몫과 나머지  (0) 2021.04.13
[Goorm LEVEL 1] 16진수  (0) 2021.04.13
[Goorm LEVEL 1] Bubble Sort  (0) 2021.04.12
[Goorm LEVEL 1] 삼각형의 넓이  (0) 2021.04.12
[Goorm LEVEL 1] 공백 없애기  (0) 2021.04.12
블로그 이미지

Or71nH

,

1. Bubble Sort

만든이 : 노곤한 덮밥

2. 문제정보

level.goorm.io/exam/43243/bubble-sort/quiz/1

 

구름LEVEL

코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이

level.goorm.io

3. 풀이

1. 일단 순차적으로 올라가면서 비교할 예정이다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
num = int(input())
user_input = list(map(int, input().split()))
for i in range(0,num-1,1):
	'''여기 부분은 반복하여 순차적으로 올라가려 하는 반복문이다'''

2. 올라가다가 숫자가 앞에게 크면 앞으로 내려주는 일을 할것이다

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
num = int(input())
user_input = list(map(int, input().split()))
for i in range(0,num-1,1):
	for k in range(i,-1,-1): ''' 뒤에서 부터 내려갈예정이라 이렇게 하였다 좀더 좋은 방법은 k자체를 -로 쓰는것이다'''
		if user_input[k] > user_input[k+1]:
			user_input[k] , user_input[k+1] = user_input[k+1], user_input[k]
            '''여기부분이 위치를 바꿔주는 곳이다'''
		else:
			break
        

3. 출력문 맞쳐주기

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
num = int(input())
user_input = list(map(int, input().split()))
for i in range(0,num-1,1):
	for k in range(i,-1,-1):
		if user_input[k] > user_input[k+1]:
			user_input[k] , user_input[k+1] = user_input[k+1], user_input[k]
		else:
			break

for i in user_input:
	print(i,end=" ")
''' 출력 부분을 맞쳐주면 끝난다 '''

4. 결과

# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
num = int(input())
user_input = list(map(int, input().split()))
for i in range(0,num-1,1):
	for k in range(i,-1,-1):
		if user_input[k] > user_input[k+1]:
			user_input[k] , user_input[k+1] = user_input[k+1], user_input[k]
		else:
			break

for i in user_input:
	print(i,end=" ")
			

'Goorm ide 코딩 문제 > Level 1' 카테고리의 다른 글

[Goorm LEVEL 1] 16진수  (0) 2021.04.13
[Goorm LEVEL 1] 거스름돈  (0) 2021.04.13
[Goorm LEVEL 1] 삼각형의 넓이  (0) 2021.04.12
[Goorm LEVEL 1] 공백 없애기  (0) 2021.04.12
[Goorm LEVEL 1] Hello Goorm!  (0) 2021.04.12
블로그 이미지

Or71nH

,