Python
-
[백준] 1297번: TV 크기코딩(Coding)/백준 문제풀이 2021. 1. 6. 18:22
링크: https://www.acmicpc.net/problem/1297 1297번: TV 크기 첫째 줄에 TV의 대각선 길이, TV의 높이 비율, TV의 너비 비율이 공백 한 칸을 사이에 두고 주어진다. 대각선 길이는 5보다 크거나 같고, 1,000보다 작거나 같은 자연수, 높이 비율은 1보다 크거나 같 www.acmicpc.net TV 크기 문제 김탑은 TV를 사러 인터넷 쇼핑몰에 들어갔다. 쇼핑을 하던 중에, TV의 크기는 그 TV의 대각선의 길이로 나타낸 다는 것을 알았다. 하지만, 김탑은 대각선의 길이가 같다고 해도, 실제 TV의 크기는 다를 수도 있다는 사실에 직접 TV를 보러갈걸 왜 인터넷 쇼핑을 대각선의 길이만 보고있는지 후회하고 있었다. 인터넷 쇼핑몰 관리자에게 이메일을 보내서 실제 높이..
-
[Python] Python 공부코딩(Coding)/Python 공부 2021. 1. 5. 14:17
안녕하세요 JSY입니다. 제가 대학교 연구보조원을 참여하면서 프로그래밍을 가르칠 기회가 생겼습니다. 프로그래밍 기초 교육을 준비하면서 만든 자료를 해당 카테고리에 ppt의 슬라이드 형식으로 올릴 예정입니다. 요즘은 python책이 잘 나와있고 혼자서 공부할 수 있을 만큼 쉽기때문에 블로그를 통해 공부할 거 같진 않겠지만, 제 나름대로 기록을 남기고 싶어서 이렇게 글을 쓰게 됩니다. python을 1학년때 처음 배웠는데, 군대 갔다오니까 다 까먹었기도 해서 0부터 다시 공부한다는 생각과 프로그래밍을 같이 공부한다는 느낌으로 글을 쓸 예정입니다. 그리고 준비한 자료와 공부한 자료를 올리는 곳으로 활용할 예정입니다. 자료 참고 및 책은 이지퍼블리싱의 "점프 투 파이썬"책을 활용할 예정입니다. 이미 구글 doc..
-
[백준] 2417번: 정수 제곱근코딩(Coding)/백준 문제풀이 2021. 1. 5. 14:04
링크: www.acmicpc.net/problem/2417 2417번: 정수 제곱근 정수가 주어지면, 그 수의 정수 제곱근을 구하는 프로그램을 작성하시오. www.acmicpc.net 정수 제곱근 문제 정수가 주어지면, 그 수의 정수 제곱근을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 정수 n이 주어진다. (0 ≤ n < 2^63) 출력 첫째 줄에 q2 ≥ n인 가장 작은 음이 아닌 정수 q를 출력한다. 문제접근 해당문제는 그냥 수학문제이다. python의 제곱연산자("**")를 통해서 문제를 쉽게 해결할 수 있다. 나는 2가지 경우를 나눠서 문제에 접근했다. 37같이 딱나눠 떨어지지 않을 경우와 36같이 딱 나눠떨어질 경우를 말이다. 첫번째, 딱 나눠떨어지지 않을 경우 입력한 값의 1/2만큼 제곱을..
-
[백준] 10871번: X보다 작은 수코딩(Coding)/백준 문제풀이 2021. 1. 4. 16:42
링크: www.acmicpc.net/problem/10871 10871번: X보다 작은 수 첫째 줄에 N과 X가 주어진다. (1 ≤ N, X ≤ 10,000) 둘째 줄에 수열 A를 이루는 정수 N개가 주어진다. 주어지는 정수는 모두 1보다 크거나 같고, 10,000보다 작거나 같은 정수이다. www.acmicpc.net X보다 작은 수 문제 정수 N개로 이루어진 수열 A와 정수 X가 주어진다. 이때, A에서 X보다 작은 수를 모두 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 N과 X가 주어진다. (1 ≤ N, X ≤ 10,000) 둘째 줄에 수열 A를 이루는 정수 N개가 주어진다. 주어지는 정수는 모두 1보다 크거나 같고, 10,000보다 작거나 같은 정수이다. 출력 X보다 작은 수를 입력받은 순서대..
-
[백준] 2739번: 구구단코딩(Coding)/백준 문제풀이 2021. 1. 4. 16:36
링크: www.acmicpc.net/problem/2739 2739번: 구구단 N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다. www.acmicpc.net 구구단 성공분류 문제 N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다. 입력 첫째 줄에 N이 주어진다. N은 1보다 크거나 같고, 9보다 작거나 같다. 출력 출력형식과 같게 N*1부터 N*9까지 출력한다. 문제접근 해당 문제는 입력받은 n에대해 구구단을 출력하는 문제이다. 여기서 요구하는 것은 for 혹은 while로 반복문을 사용할 수 있는가 이다. 정말 간단하게 반복문을 사용해 해결이 가능하다. 코드 """ 백준 알고리즘 2739번: 구구단 h..
-
[백준] 14681번: 사분면 고르기코딩(Coding)/백준 문제풀이 2021. 1. 4. 16:31
링크: www.acmicpc.net/problem/14681 14681번: 사분면 고르기 점 (x, y)의 사분면 번호(1, 2, 3, 4 중 하나)를 출력한다. www.acmicpc.net 사분면 고르기 문제 흔한 수학 문제 중 하나는 주어진 점이 어느 사분면에 속하는지 알아내는 것이다. 사분면은 아래 그림처럼 1부터 4까지 번호를 갖는다. "Quadrant n"은 "제n사분면"이라는 뜻이다. 예를 들어, 좌표가 (12, 5)인 점 A는 x좌표와 y좌표가 모두 양수이므로 제1사분면에 속한다. 점 B는 x좌표가 음수이고 y좌표가 양수이므로 제2사분면에 속한다. 점의 좌표를 입력받아 그 점이 어느 사분면에 속하는지 알아내는 프로그램을 작성하시오. 단, x좌표와 y좌표는 모두 양수나 음수라고 가정한다. 입력..
-
[백준] 1436번: 영화감독 숌코딩(Coding)/백준 문제풀이 2021. 1. 4. 14:46
링크: www.acmicpc.net/problem/1436 1436번: 영화감독 숌 666은 종말을 나타내는 숫자라고 한다. 따라서, 많은 블록버스터 영화에서는 666이 들어간 제목을 많이 사용한다. 영화감독 숌은 세상의 종말 이라는 시리즈 영화의 감독이다. 조지 루카스는 스타 www.acmicpc.net 영화감독 숌 문제 666은 종말을 나타내는 숫자라고 한다. 따라서, 많은 블록버스터 영화에서는 666이 들어간 제목을 많이 사용한다. 영화감독 숌은 세상의 종말 이라는 시리즈 영화의 감독이다. 조지 루카스는 스타워즈를 만들 때, 스타워즈 1, 스타워즈 2, 스타워즈 3, 스타워즈 4, 스타워즈 5, 스타워즈 6과 같이 이름을 지었고, 피터 잭슨은 반지의 제왕을 만들 때, 반지의 제왕 1, 반지의 제왕 ..
-
[백준] 1924번: 2007년코딩(Coding)/백준 문제풀이 2020. 12. 31. 12:27
링크: www.acmicpc.net/problem/1924 1924번: 2007년 첫째 줄에 빈 칸을 사이에 두고 x(1 ≤ x ≤ 12)와 y(1 ≤ y ≤ 31)이 주어진다. 참고로 2007년에는 1, 3, 5, 7, 8, 10, 12월은 31일까지, 4, 6, 9, 11월은 30일까지, 2월은 28일까지 있다. www.acmicpc.net 2007년 성공분류 문제 오늘은 2007년 1월 1일 월요일이다. 그렇다면 2007년 x월 y일은 무슨 요일일까? 이를 알아내는 프로그램을 작성하시오. 입력 첫째 줄에 빈 칸을 사이에 두고 x(1 ≤ x ≤ 12)와 y(1 ≤ y ≤ 31)이 주어진다. 참고로 2007년에는 1, 3, 5, 7, 8, 10, 12월은 31일까지, 4, 6, 9, 11월은 30일까지..