路過的一隻山姆

@sam571128

Joined on Jul 5, 2020

  • Pass by Reference & Pass by Value 在 Python 裡面,假設我們有一個 object A 和一個 object B,那麼當我們去做 B = A,那麼如果我們去修改 B 的值,那麼 A 也會一起被改到。 A = [1] B = A B.append(2) print(A) # [1, 2] 這個概念稱為「Pass by Reference」,也就是 A 傳了 位置 給 B,而 A 和 B 在這之後,會「共用」這個位置的值。這種方式在多數的高階程式語言(如:Java),都是用這樣的方式去實作的。而當我們希望兩個人是不同的 object 時,我們會需要做所謂的 Deep Copy,也就是將這個 object 內的所有東西複製成另一個東西。 而在 C++ 當中,我們也可以藉由 & 的符號(跟位址同個符號)去傳一個參考值給函數。範例就像下面這樣:
     Like  Bookmark
  • <span style="color:red">*</span> means important problem Solve all stared problem should give you the ability to solve similar ones Greedy Algorithms [ ] CSES - Movie Festival<span style="color:red">*</span> [ ] CSES - Stick Division<span style="color:red">*</span> [ ] Codeforces 1526C2 - Potions (Hard Version)<span style="color:red">*</span> [ ] CSES - Tasks and Deadlines [ ] CSES - Room Allocation
     Like  Bookmark
  • <span style="color:red">*</span> means important problem Solve all stared problem should give you the ability to solve similar ones Bruteforce [ ] CSES - Creating Strings<span style="color:red">*</span> [ ] CSES - Apple Division<span style="color:red">*</span> [ ] AtCoder Beginner Contest 190C - Bowls and Dishes [ ] AtCoder Beginner Contest 197C - ORXOR [ ] Codeforces 812B - Sagheer, the Hausmeister
     Like  Bookmark
  • C++ Syntax This section does not have exact problem link, but some problems for practicing C++ [ ] A * B [ ] CSES - Introductory Problems [ ] Codeforces problems with rating 800~1000 [ ] AtCoder Beginner Contest Problem A, B, C vector / deque / queue [ ] Codeforces 847A - Union of Doubly Linked Lists
     Like  Bookmark
  • An EZ Walking Problem 這是一個簡單的走路問題。 給一個 $N \times N$ 的網格圖, Kirby 一開始在 $(1,1)$,它一次可以往上下左右分別走不超過 $U,D,L,R$ 步(至少要走一步才算一次移動),一共會移動 $M$ 次,請問能使 Kirby 最後停在 $(N,N)$ 的方法數為多少? (如果走到沒有辦法在移動了,但沒有走完 $M$ 次,不會算有走到 $(N,N)$) Intput 第一行有兩個正整數 $N, M$,表示網格圖的大小和要走幾次 第二行有四個非負整數 $U,D,L,R$,表示你一次最多可以往上下左右走多少步
     Like  Bookmark
  • 簡單的小情境 妳要找一個陣列的最大連續和,所以寫出了這份 code!欸? 為什麼答案都是 $0$ 呢 ヽ(*。>Д<)o゜ 題目: CSES - Maximum Subarray Sum int n;cin>>n; vector<int> a(n); for(int i=0;i<n;i++){ int x;cin>>x; a.push_back(x); }
     Like  Bookmark
  • A. 小業教授的研究計畫 tags: constructive algorithm author: ColtenOuO, 難度定位: Easy 結論:只有唯一的 $1$ 種填法 如果要你輸出那組解呢? ::: spoiler 參考程式碼 (ColtenOuO) #include <bits/stdc++.h>
     Like 1 Bookmark