전체 글658 백준 1934 Python https://www.acmicpc.net/problem/1934 T = int(input())for _ in range(T): A, B = map(int, input().split()) result = A*B while B>0: A,B = B, A%B //유클리드 호제법 print(result//A)https://devum.tistory.com/128b), a와 b의 최대공약수는 b와 r의 최대공약수와 같다. 예시 a=72, b=30일 때, 최대공약수는 6이" data-og-host="devum.tistory.com" data-og-source-url="https://devum.tistory.com/128" data-og-url="https://devum.tisto.. 2024. 9. 12. 백준 10828 c# https://www.acmicpc.net/problem/10828 using System;using System.Collections.Generic;using System.Text;namespace boj{ class Program { static void Main(string[] args) { var A = int.Parse(Console.ReadLine()); //첫째줄에는 명령의 수가 주어진다 Stack stack = new(); //stack 객체 생성 StringBuilder sw = new(); //출력하기 위한 sw객체 생성 런타임 초과 방지 for (int i = 0; i 2024. 9. 10. 백준 2609 import matha, b = map(int, input().split())print(math.gcd(a, b))print(math.lcm(a, b)) 파이썬은 3.9이상 버전부터 math 모듈속에 이미 최대공약수와 최소공배수를 구하는 함수가 내장되어 있다. https://dotiromoook.tistory.com/28 [python] map 함수 사용법, 동작원리 및 특징 (예제포함)python에 map 함수에 대해 알아봅시다. Python의 map() 함수는 여러 개의 데이터를 받아서 각각의 요소에 함수를 적용한 결과를 반환하는 내장 함수입니다. 리스트, 튜플 등의 반복 가능한(iterable) 객체dotiromoook.tistory.comhttps://codingapple.com/unit/py.. 2024. 8. 20. 파이썬 Python r = [1,2,3,4,5,1,2,3]print(r.index(3)) # array.index(x) 리스트에서 x의 인덱스 반환print(r.index(3,3)) #array.index(x, start) 리스트[start:]에서 x의 인덱스 반환 3번째 index부터 3이라는 값을 찾고 그 index를 출력if 5 in r: #R배열에서 5값이 있으면 출력 print('exist')if 100 in r: print('exist')r.sort() #정렬 기본정렬은 오름차순print(r)r.sort(reverse=True) # 내림차순print(r)r.reverse()print(r)s = 'My name is Mike'to_split = s.split(' ')#공백을 기준으로 띄워쓰기print(.. 2024. 8. 1. 이전 1 2 3 4 5 6 7 ··· 165 다음