Scroll indicator done

전체 글 (290)

  1. [B1018][체스판 다시 칠하기][python] 2021.07.01

    n, m = map(int, input().split()) m_list = [] for _ in range(n): m_list.append(input()) n_min = 64 for i in range(n - 7): for j in range(m - 7): cnt1 = 0 cnt2 = 0 for k in range(i, i + 8): for s in range(j, j + 8): if k % 2 == 0 and s % 2 == 0: if m_list[k][s] == 'B': cnt1 += 1 elif k % 2 == 1 and s % 2 == 1: if m_list[k][s] == 'B': cnt1 += 1 elif k % 2 == 0 and s % 2 == 1: if m_list[k][s] == 'W'..

  2. [B1268][임시 반장 정하기][C++] 2021.07.01

    #include using namespace std; int grade[1001][6]; // 애들은 1000명까지, 1~5학년 bool check[1001][1001] = { false, }; int cnt[1001]; int n; int main() { cin >> n; for (int i = 0; i > grade[i][j]; for (int i = 0; i < 5; i++) { for (int j = 0; j < n - 1; j++) { for (int k = j + 1; k < n; k++) { if (grade[j][i] == grade[k][i]) { check[j][k] = check[k][j] = true; } ..

  3. [B1780][종이의 개수][C++] 2021.06.30

    #include using namespace std; int n; int p[2188][2188]; int cnt[3]; // -1,0,1 void f(int x, int y, int size) { bool isSame = true; for (int i = x; i < x + size; i++) { for (int j = y; j < y + size; j++) { if (p[x][y] != p[i][j]) { isSame = false; break; } } } if (isSame) { cnt[p[x][y] + 1]++; return; } for (int i = x; i < x + size; i += size / 3) { for (int j = y; j < y + size; j += size / 3) { ..

  4. 2021.06.30 빅데이터 분석을 위한 스파크 프로그래밍 - 머신 러닝 2021.06.30

    # 레이블 : 올바른 출력값 지도 학습 : 입력에 대한 올바른 출력 값과 입력 값을 함께 학습 후 아직 답이 알려지지 않은 새로운 입력 값에 대한 출력 값 찾는 학습 방식 - 레이블을 포함한 데이터 셋 = LabeledPoint 데이터 타입 사용 # 연속형 데이터 / 이산형 데이터 연속 : 무게, 온도, 습도 = 연속적인 값 이산 : 나이, 성별, 개수 = 불연속적인 값 스파크 Mlib 에서 제공하는 API 사용 시 모두 double 타입 데이터만 사용 가능 # 알고리즘, 모델 모델 : 알고리즘의 산출물 (알고리즘 + 데이터) 학습 : 알고리즘에 데이터를 적용하는 과정, 결과물은 모델 (=함수) 스파크 Mlib 에서, 로지스틱 회귀 알고리즘 - LogisticRegression 클래스 (fit에 훈련 데..

  5. 2021.06.29 빅데이터 분석을 위한 스파크 프로그래밍 - DataFrame 함수 2021.06.29

    # sample_df1, sample_df2, ldf, rdf # sample dataFrame 1 Person = collections.namedtuple('Person', 'name age job') row1 = Person(name="hayoon", age=7, job="student") row2 = Person(name="sunwoo", age=13, job="student") row3 = Person(name="hajoo", age=5, job="kindergartener") row4 = Person(name="jinwoo", age=13, job="student") data = [row1, row2, row3, row4] sample_df = spark.createDataFrame(data) ..

  6. [B9375][패션왕 신해빈][C++] 2021.06.29

    #include #include #include #include using namespace std; int t; int main() { cin >> t; while (t--) { unordered_map m; int n; cin >> n; while (n--) { string clothes, kind; cin >> clothes >> kind; if (m.find(kind) == m.end()) m.insert({ kind, 1 }); else m[kind]++; } int cnt = 1; for (auto i : m) cnt *= (i.second + 1); cout

  7. [B11727][2xn 타일링 2][C++] 2021.06.29

    #include using namespace std; int n; int dp[1000]; int main(){ cin >> n; dp[0] = 1; dp[1] = 1; for(int i = 2; i

  8. 2021.06.28 빅데이터 분석을 위한 스파크 프로그래밍 - DataFrame, DataSet 2021.06.28

    ## dataframe_sample.py, word.py class Word: def __init__(self, word, count): self.word = word self.count = count # createDataFrame() import collections from pyspark import StorageLevel from pyspark.sql import Row from pyspark.sql import SparkSession from pyspark.sql.functions import * from pyspark.sql import functions from pyspark.sql.types import * from pyspark.sql.window import Window import t..

  9. [B1541][잃어버린 괄호][C++] 2021.06.25

    #include #include using namespace std; int n = 0; int m = 0; string nums = ""; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> s; for (int i = 0; i

  10. 2021.06.25 빅데이터 분석을 위한 스파크 프로그래밍 - RDD 트랜스포메이션 ~ 액션 2021.06.25

    https://ralasun.github.io/spark%20programming/2020/12/07/rdd(2)/ RDD, Resilient Distributed Dataset에 대하여[2] - RDD기본액션, RDD트랜스포메이션 · Ralasun Resarch Blog RDD, Resilient Distributed Dataset에 대하여[2] - RDD기본액션, RDD트랜스포메이션 07 Dec 2020 | data-engineering 이번 포스팅은 지난 포스팅 에 이어서 진행하도록 하겠습니다. 교재는 빅데이터 분석을 위한 스파 ralasun.github.io https://ralasun.github.io/spark%20programming/2021/01/07/rdd(3)/ RDD, Resilien..

  11. 2021.06.25 빅데이터 분석을 위한 스파크 프로그래밍 - virtualbox로 intellij 시작하기 2021.06.25

    sudo apt install git pip3 install jupyter ## github 소스 가져오기 VCS -> get from version control -> github.com/wikibook/spark code 주소 복사 url에 입력 파이썬 버전 명시 프로젝트 세팅 / 프로젝트 / 자바에서 파이썬으로 변경 master에다 local대신 spark://IP_ADRESS:7077 #collect : driver로 출력하게 해줌 #doMap() cd $SPARK_HOME cd bin ./spark-submit --master spark://20.194.22.56:7077 /PATH/FILE.py (conf.set()이랑 master 없애줘야함) #mapPartitions() - 파티션 단위로 ..

  12. [B11659][구간 합 구하기 4][C++] 2021.06.24

    #include using namespace std; int n, m, ps[100001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (int i = 0; i > x; ps[i + 1] = ps[i] + x; } for (int i = 0; i > s >> f; cout

  13. [B1676][팩토리얼 0의 개수][C++] 2021.06.23

    #include using namespace std; int n; int cnt; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; while (n >= 5) { cnt += n / 5; n /= 5; } cout > n; cout

  14. [B1260][DFS와 BFS][C++] 2021.06.23

    #include #include using namespace std; int n, m, v; int map[1001][1001]; bool visit[1001]; queue Q; void DFS(int v) { visit[v] = true; cout x >> y; map[x][y] = 1; map[y][x] = 1; } for (int i = 1; i

  15. 2021.06.23 빅데이터 분석을 위한 스파크 프로그래밍 - VirtualBox 통해 pyspark 실행하기 2021.06.23

    virtual box 다운로드 https://www.virtualbox.org/wiki/Downloads 가상머신 만들기 이름 스파크2 리눅스, 우분투로 설정 - 메모리 4096 - 새 가상 디스크 만들기 - VDI - 동적 할당 - 하드 20 Ubuntu 18.04.5 LTS (Bionic Beaver) Select an image Ubuntu is distributed on three types of images described below. Desktop image The desktop image allows you to try Ubuntu without changing your computer at all, and at your option to install it permanently later..

  16. [B17219][비밀번호 찾기][C++] 2021.06.21

    #include #include #include using namespace std; map M; int n, m; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (int i = 0; i > site >> pw; M[site] = pw; } for (int i = 0; i > s; cout

  17. [B9461][파도반 수열][C++] 2021.06.18

    #include using namespace std; int t, n; long long dp[101] = { 0 }; int main() { cin >> t; dp[1] = 1; dp[2] = 1; dp[3] = 1; for (int i = 4; i > n; cout

  18. [B7662][이중 우선 순위 큐][C++] 2021.06.17

    #include #include #include #include #include using namespace std; const int MAX = 1000001; int n; bool visit[MAX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int test; cin >> test; for (int t = 0; t > n; priority_queue minpq; priority_queue maxpq; for (int i = 0; i > c >> num; if (c == 'I') { maxpq.push({ num, i }); m..

  19. [B18870][좌표 압축][C++] 2021.06.16

    #include #include #include using namespace std; int n, x; vector v1; vector v2(1000001); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for (int i = 0; i > x; v1.push_back({ x, i }); } sort(v1.begin(), v1.end()); int tmp = v1[0].first; int cnt = 0; v2[v1[0].second] = 0; for (int i = 1; i < n; i++) { if (tmp == v1[i].first) { v2[v1[i].seco..

  20. [B1074][Z][C++] 2021.06.16

    #include #include using namespace std; int n, r, c; int visit; void z(int row, int col, int size) { if (row == r && col == c) { cout = col) { z(row, col, size / 2); // 1 z(row, col + size / 2, size / 2); // 2 z(row + size / 2, col, size / 2); // 3 z(row + size / 2, col + size / 2, size / 2); //4 } else { visit += size * size; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin ..