上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 31 下一页
摘要: SAT是是适定性(Satisfiability)问题的简称。一般形式为 k - 适定性问题,简称 k-SAT。而当$k>2$时该问题为 NP 完全的。 # 定义 有 $n$ 个布尔变量 $x_1$$\sim$$x_n$,另有 $m$ 个需要满足的条件,每个条件的形式都是 「$x_i$ 为 `true 阅读全文
posted @ 2023-08-23 22:01 PHarr 阅读(19) 评论(0) 推荐(0) 编辑
摘要: # A - tcdr ```cpp #include using namespace std; int32_t main() { string s; cin >> s; for( auto i : s){ if( i != 'a' and i != 'e' and i != 'i' and i != 阅读全文
posted @ 2023-08-23 16:03 PHarr 阅读(29) 评论(0) 推荐(0) 编辑
摘要: # 概念 **连通** 在有向图中存在$u$到$v$的路径,则称$u$可达$v$。如果$u,v$互相可达,则$u,v$连通。 **强连通** 有向图$G$强连通指$G$中任意两个结点连通。 **强联通分量** 有向图的极大强连通子图。 # DFS 生成树 在有向图上进行 DFS 会形成森林。DFS会 阅读全文
posted @ 2023-08-22 19:30 PHarr 阅读(28) 评论(0) 推荐(0) 编辑
摘要: # A-Alien Sunset 这到题,用一个数组表示当前时间有多少个星球是夜晚,这样就转换成了区间修改单点查询。因为只查询一次,所以用差分即可。 ```cpp #include using namespace std; #define int long long const int m = 18 阅读全文
posted @ 2023-08-10 14:33 PHarr 阅读(93) 评论(0) 推荐(0) 编辑
摘要: # A. Array Coloring ```cpp #include using namespace std; void solve() { int n; cin >> n; int sum = 0; for( int i = 1 , x ; i > x , sum += x; if( sum % 阅读全文
posted @ 2023-08-09 10:27 PHarr 阅读(39) 评论(0) 推荐(0) 编辑
摘要: # A - To Be Saikyo ```cpp #include using namespace std; int main(){ ios::sync_with_stdio(0),cin.tie(0); int n; cin >> n; vector a(n); for( auto & i : 阅读全文
posted @ 2023-08-07 10:20 PHarr 阅读(13) 评论(0) 推荐(0) 编辑
摘要: # 600A. Extract Numbers 划分一下然后特判即可。 ```cpp #include using namespace std; int32_t main() { string s , t = ""; cin >> s; vector a , b; s += ";"; for( au 阅读全文
posted @ 2023-08-04 20:20 PHarr 阅读(9) 评论(0) 推荐(0) 编辑
摘要: # A. Berland Poker 先尽可能的吧小丑给一个人,在把剩下的小丑尽可能的平分,最后计算差值即可。 ```cpp #include using namespace std; void solve() { int n, m, k, t; cin >> n >> m >> k, t = n 阅读全文
posted @ 2023-08-02 17:38 PHarr 阅读(19) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1487 # A. Arena 统计与最小值不同的数字数量。 ```cpp #include using namespace std; #define int long long const int M = (1 > n; vector 阅读全文
posted @ 2023-08-02 17:38 PHarr 阅读(5) 评论(0) 推荐(0) 编辑
摘要: # A - 把你砍成两半! 在本地找规律就会发现,当$a_1$确定时,$a_i$一定是$a_1$的倍数。所以答案就是 $$ \sum C_{\frac{n}{a_1}-1}^{k-1} $$ ```cpp #include using namespace std; #define int long 阅读全文
posted @ 2023-08-02 17:38 PHarr 阅读(50) 评论(0) 推荐(1) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 31 下一页