1로 만들기

문제정수 X에 사용할 수 있는 연산은 다음과 같이 세 가지 이다.X가 3으로 나누어 떨어지면, 3으로 나눈다.X가 2로 나누어 떨어지면, 2로 나눈다.1을 뺀다.정수 N이 주어졌을 때, 위와 같은 연산 세 개를 적절히 사용해서 1을 만들려고 한다. 연산을 사용하는 횟수

2023년 3월 29일
·
0개의 댓글
·

Speeding Ticket

말썽꾸러기 연정이는 오늘도 태우의 자동차를 몰래타고 신나게 도로를 달리는 중이다.도로는 정확히 100km 이고, 연정이는 무조건 도로의 끝까지 달려야한다.도로의 각 구간에는 제한속도를 지정해 두었으나 쿨한 연정이는 속도 위반에는 개의치 않아 (더군다나 자신의 차도 아니

2023년 1월 7일
·
0개의 댓글
·
post-thumbnail

C - Extra Character(Atcoder)

PS: 1\. I got the data in org and extra.2\. Next, I searched every letters of each variables and saw if they corresponded.3\. When a different letter

2023년 1월 4일
·
0개의 댓글
·
post-thumbnail

B - Inverse Prefix Sum(Atcoder)

PS: I first got the data in n and s.Then, I just subtracted every element of s from their respective previous elements and put them in a. Lastly, I pr

2023년 1월 4일
·
0개의 댓글
·

A: Pawn on a Grid (Atcoder)

Problem StatementThere is a grid with H rows from top to bottom and W columns from left to right. Each square has a piece placed on it or is empty....

2023년 1월 2일
·
0개의 댓글
·
post-thumbnail

Recursive Function (재귀 함수)

Recursive Function usually helps beginners of Computer Science to further understand basic algorithms and also develop their 'computer-science-thinkin

2022년 8월 3일
·
0개의 댓글
·

소수

n = int(input())def isPrime(a): isPrime = True for i in range(2, a): if a % i == 0: return False return Truefor i in range(2, n-1): if isP

2022년 7월 26일
·
0개의 댓글
·
post-thumbnail

최대공약수와 최소공배수 구하기 (feat. 유클리드 호제법)

시작하기 앞서 ... 유클리드 호제법의 풀이만 필요하다면 ()으로, 코딩만 필요하다면 ()로 가주길 바랍니다. 1. 정의 약수: 어떤 수/식을 나누었을 때 나머지가 없이 떨어지는 수 예) 4은 8의 약수, 1은 모든 정수의 약수 배수: 어떤 수에 어떤 수를 곱한

2022년 7월 17일
·
0개의 댓글
·