목록코테/종만북 (3)
공부기록
문제 https://algospot.com/judge/problem/read/WILDCARD# 코드 #include #include using namespace std; bool match(const string& w, const string& s) { int pos = 0; while (pos < w.size() && pos < s.size() && (w[pos] == '?' || w[pos] == s[pos])) pos++; if (pos == w.size()) return w.size() == s.size(); if (w[pos] == '*') { for (int skip = 0; pos + skip
문제 https://algospot.com/judge/problem/read/FENCE 코드 #include #include #include using namespace std; void dfs(vector &inputs, int &max_val, int start, int end) { if (start > end) return; int min_val = 2e9; int min_idx = start; for (int i = start; i inputs[i]) { min_val = inputs[i]; min_idx = i; } } max_val = max(max_val, min_val * (end - start + 1)); dfs(inputs, max_val, start, min_idx - 1); dfs(..
문제 https://algospot.com/judge/problem/read/CLOCKSYNC 코드 #include #include #include using namespace std; vector v; int clocks[16]; int min_val = 2e9; bool is_ans() { for (int i = 0; i < 16; i++) { if (clocks[i] != 0) return false; } return true; } void dfs(int cur_idx, int cur_count, int tot_count) { if (cur_idx == 10) { if(is_ans()) min_val = min(min_val, tot_count); } else { if (cur_count < 3) ..