# USACO ```cpp= void io(string s){ freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } int main(){ cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); io(題目名稱); return 0; } ``` # STL 請熟悉各種工具 ## Stack https://zerojudge.tw/ShowProblem?problemid=c123 https://zerojudge.tw/ShowProblem?problemid=a565 https://zerojudge.tw/ShowProblem?problemid=a813 https://cses.fi/problemset/task/1142/ https://cses.fi/problemset/task/1147 ## Queue -- ## Set https://en.cppreference.com/w/cpp/container/set ```cpp= //set<type> set<int> s; //void insert(element) s.insert(1); //void erase(element) s.erase(1); //iterator find(element); auto it = s.find(1); //void erase(iterator) s.erase(it); ``` USACO Guide : https://usaco.guide/bronze/intro-sets https://zerojudge.tw/ShowProblem?problemid=b606 https://tioj.ck.tp.edu.tw/problems/1911 ## Map https://en.cppreference.com/w/cpp/container/map ```cpp= //map<type1,type2> map<string,int> m; //名稱,年紀 string p1 = "Max"; m[p1] = 30; //也可以寫作 m["Max"] = 30; cout << m[Max] << '\n'; // 等價於 cout << m[p1] << '\n'; // output: // 30 ``` USACO Guide : https://usaco.guide/bronze/intro-sets https://zerojudge.tw/ShowProblem?problemid=d518 https://tioj.ck.tp.edu.tw/problems/1161 # Naive / Complete Search 簡易暴力搜索法 https://zerojudge.tw/ShowProblem?problemid=a040 https://zerojudge.tw/ShowProblem?problemid=a872 # Greedy USACO Guide : https://usaco.guide/bronze/intro-greedy https://tioj.ck.tp.edu.tw/problems/1072 https://zerojudge.tw/ShowProblem?problemid=a567 # Graph USACO Guide : https://usaco.guide/bronze/intro-graphs ## DFS https://zerojudge.tw/ShowProblem?problemid=a229 https://zerojudge.tw/ShowProblem?problemid=a981 ## # BinarySearch USACO Guide : https://usaco.guide/silver/binary-search https://zerojudge.tw/ShowProblem?problemid=d732 https://zerojudge.tw/ShowProblem?problemid=c575 https://codeforces.com/contest/1201/problem/C https://zerojudge.tw/ShowProblem?problemid=b844 https://zerojudge.tw/ShowProblem?problemid=b870
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up