전체 글 474

[python, C++] 백준 1292 쉽게 푸는 문제

https://www.acmicpc.net/problem/1292 1292번: 쉽게 푸는 문제 첫째 줄에 구간의 시작과 끝을 나타내는 정수 A, B(1 ≤ A ≤ B ≤ 1,000)가 주어진다. 즉, 수열에서 A번째 숫자부터 B번째 숫자까지 합을 구하면 된다. www.acmicpc.net - Python a, b = map(int, input().split()) numbers = [] Sum = 0 for i in range(1,1001): for j in range(i) : numbers.append(i) print(sum(numbers[a-1:b])) - C++ #include #include #include #include #include #include #include using namespace..

[python, C++] 백준 2953 나는 요리사다

https://www.acmicpc.net/problem/2953 2953번: 나는 요리사다 "나는 요리사다"는 다섯 참가자들이 서로의 요리 실력을 뽐내는 티비 프로이다. 각 참가자는 자신있는 음식을 하나씩 만들어오고, 서로 다른 사람의 음식을 점수로 평가해준다. 점수는 1점부터 5 www.acmicpc.net - python import sys score = {} for i in range(5): s = sum(list(map(int, sys.stdin.readline().split()))) score[i+1] = s score = sorted(score.items(), key = lambda x : x[1]) for i in score[-1]: print(i, end=" ") - C++ #includ..

[python, C++] 백준 2592 대표값

https://www.acmicpc.net/problem/2592 2592번: 대표값 어떤 수들이 있을 때, 그 수들을 대표하는 값으로 가장 흔하게 쓰이는 것은 평균이다. 평균은 주어진 모든 수의 합을 수의 개수로 나눈 것이다. 예를 들어 10, 40, 30, 60, 30, 20, 60, 30, 40, 50의 평균은 www.acmicpc.net - python import sys numbers = [] element = {} for i in range(10) : tmp = int(sys.stdin.readline()) numbers.append(tmp) if tmp not in element: element[tmp] = 0 else : element[tmp] +=1 print(int(sum(numbers..

[python, C++] 백준 2577 숫자의 개수

- python a=int(input()); b=int(input()); c=int(input()) mul = str(a*b*c) for i in range(10) : print(mul.count(str(i))) - C++ #include #include #include using namespace std; int main() { int a, b, c; int mul = 0; string str; int count[10] = {}; cin >> a >> b >> c; mul = a * b * c; string s = to_string(mul); // int to string // s 순회하며 해당 인덱스 값 +1 for (char ch : s) { count[ch-'0']++; // **아스키코드 0값 ..

오늘 한 거

pytorch에서 에러가 생겨서 cuda10.0, cudnn8.2.4 재설치 python3.8 재설치 -> 가상환경 'py38' 만들어서 관련 라이브러리 다 설치 근데도 런타임 에러 발생 RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if __name__ == '__mai..

혼공머 스터디 (1~2장)

도미, 빙어 분류 문제 sklearn k-최근점 이웃 알고리즘 # 도미 데이터(길이와 무게) 준비하기 bream_length = [25.4, 26.3, 26.5, 29.0, 29.0, 29.7, 29.7, 30.0, 30.0, 30.7, 31.0, 31.0, 31.5, 32.0, 32.0, 32.0, 33.0, 33.0, 33.5, 33.5, 34.0, 34.0, 34.5, 35.0, 35.0, 35.0, 35.0, 36.0, 36.0, 37.0, 38.5, 38.5, 39.5, 41.0, 41.0] bream_weight = [242.0, 290.0, 340.0, 363.0, 430.0, 450.0, 500.0, 390.0, 450.0, 500.0, 475.0, 500.0, 500.0, 340.0, 6..

[c++] 백준 2908 상수

#include #include #include #include using namespace std; string str_arr[1000]; int str_cnt = 0; int main() { //string 변수 a 선언 string a; //띄어쓰기를 포함한 전체 입력을 받는다. getline(cin, a); //받은 입력을 C의 형식으로 char buffer에 넣어주기 위한 변수선언. new는 malloc과 같은 동적할당 수행 char* str_buff = new char[1000]; //받은 입력 string a를 str_buff에 넣어준다. strcpy(str_buff, a.c_str()); //strtok이 포인터를 반환하기때문에 tok을 포인터로 선언. 띄어쓰기를 기준으로 나눈다. char..