분류 전체보기
-
[C++] cin.ignore와 버퍼에 대한 이해Programming 기초/C++ 2024. 6. 28. 19:31
cin cin은 character input의 약자로, 버퍼의 값을 읽어온다. 만약 버퍼에 읽어올 값이 없으면 표준입력스트림으로부터 입력을 받아와 버퍼에 저장하고나서 버퍼의 값을 읽어온다.입력을 받는다는 것이 아닌 버퍼를 먼저 읽으려고 한다는 관점이 중요하다.(버퍼는 자료구조 queue와 유사하다. 선입선출로 작동한다.) 'cin >>' 은 공백(스페이스, 탭, 줄바꿈)문자를 기준으로 끊어서 읽어오고, 공백문자는 무시한다.#include using namespace std;int main() { char name[100]; cout > name; cout 0. 버퍼에 다음과 같이 저장된다. [ j ] [ o ] [ h ] [ n ] [ ' ' ] [ n ] [ a ] [ n ] [ a ]..
-
[softeer] 함께하는 효도 - 파이썬Programming 기초/Coding Test 2024. 6. 28. 00:02
함께하는 효도 문제https://softeer.ai/practice/7727 파이썬 정답코드import sysfrom itertools import product# 한 명이 움직이는 모든 방향의 조합 : [(0~3), (0~3), (0~3)] -> 4^3 = 64# 모든 인원의 움직이는 방향의 조합 : (64) ^ 3 = 263144input = sys.stdin.readlinen, m = map(int,input().split())graph = [list(map(int, input().split())) for _ in range(n)]start_positions = [list(map(int, input().split())) for _ in range(m)]# 모든 경우의 수t = 3 # 3초paths..
-
[softeer] 나머지 정리 활용Programming 기초/Coding Test 2024. 6. 26. 22:28
바이러스 - pythonhttps://softeer.ai/practice/6284 import sys# 2초# 1000000007# k*p^n % (7+10^8)input = sys.stdin.readlinek, p, n = map(int, input().split())result = k % 1000000007remainder = p % 1000000007for _ in range(n): result = (result * remainder) % 1000000007print(result) pow 내장함수 사용할 경우아래와 같이 간단하다.k*pow(p,n,1000000007)%1000000007 나머지 정리를 이용한 정답 코드는 아래와 같은 원리로 작동한다.A * B * C * D ... % Q 는 ..
-
[softeer] 진정한 효도 - pythonProgramming 기초/Coding Test 2024. 6. 26. 21:02
import sys# 1초 고려하자# 비용 = max - min (해당 라인), 6라인의 브루트포스# cost = [row1, column1, row2, column2, row3, column3]input = sys.stdin.readlinecost = []matrix = [list(map(int,input().split())) for _ in range(3)]for i in range(3): cost.append(max(matrix[i]) - min(matrix[i])) column = [matrix[j][i] for j in range(3)] # i번째 컬럼 cost.append(max(column)-min(column))print(min(cost))
-
[softeer] str concatenate 은 += 가 아닌 join 메소드를 사용하자Programming 기초/Coding Test 2024. 6. 25. 23:43
한양대 HCPC 2023] X marks the Spotimport sysinput = sys.stdin.readlinen = int(input())result = []for _ in range(n) : s, t = input().split() result.append(t[s.upper().find('X')].upper())print("".join(result)) 처음에 += 로 result를 작성했는데, 5초가 넘어버려서 시간 초과가 떴다.join 메소드로 변경하니 시간이 1초대로 나왔다. string은 +를 할 때 두 문자열 길이만큼의 연산 시간이 걸린다.그 이유는 s1,s2 라는 각각의 변수에 string을 저장해두었다고 하면, s = s1+s2 연산시 새로운 메모리 공간에 s1를 복사하..
-
LaTeX 쉽게 캡처해서 추출 복사하기et al 2024. 6. 4. 11:32
공부하면서 수식을 노션에 정리하는 경우가 많았다. 어지간한 Latex 문법을 외웠을 정도로 많이 타이핑해왔는데, '문득 이 불편함은 분명 많은 사람들이 느꼈을 텐데..?'라는 생각이 들었고, 이미지를 캡처해서 바로 Latex를 따오는 프로그램이나 chrome 확장프로그램이 있을 것 같다는 강한 확신이 들었다.. 아니나 다를까, 찾기 시작한지 십초만에, 너무나 좋은 프로그램을 발견했다.. 바로 Mathpix이다. 아래 유튜브는 Mathpix의 주요 기능을 보여주는 하이라이트 영상이다.https://www.youtube.com/watch?v=Jki2FcW8Bw8&t=5s 아래 링크가 다운로드 링크이다. Linux도 지원해줘서 너무나 좋다. ubuntu 20.04 os에서 잘 돌아감을 확인했다.https..
-
[open3d] ubuntu 20.04 docker 설치 open3d 시각화 에러 해결Framework 2024. 5. 21. 21:46
0. backgroundlocal os : ubuntu 20.04gpu : nvidia 4060ti docker 환경에서 open3d의 시각화 코드를 실행하고자 했지만 OpenGL에러가 발생했다.vscode에서 발생한 에러는 아래와 같다. [Open3D WARNING] GLFW Error: GLX: Failed to create context: BadValue (integer parameter out of range for operation)[Open3D WARNING] Failed to create window[Open3D WARNING] [DrawGeometries] Failed creating OpenGL window. (터미널에서 py파일을 실행할 때는 GLX 대신에 X11가 출력되는 에러가 발생..
-
[react]et al/AI Tech 6 2024. 3. 10. 11:48
react/my-app에서 npm install react-router-dom@6 To address all issues (including breaking changes), run: npm audit fix --force Run `npm audit` for details. 설치하려고 보니, 위와 같은 에러가 떴는데, 이는 패키지 의존성에 있어서 취약해질 수 있다는 경고다. package-lock.json을 살펴보니 이미 설치된 패키기라서 에러가 떴었다. router란 무엇인가? 라우팅의 개념을 간단하게 알아보면 사용자가 요청한 링크주소 즉, URL에 맞는 페이지를 찾아서 보여주는 것 MPA 방식에서는 여러페이지를 분리해두고 페이지간의 이동으로 이 라우트 시스템을 구축을 하지만, 그러나 SPA 방식의 리..