使用递归的穷举搜索 使用递归的穷举搜索 Subsets 子集 https://cses.fi/problemset/task/1623 递归生成子集 编写一个递归函数,遍历所有可能的分组方式。 在某个索引处,我们要么将 applei 添加到第一个集合,要么添加到第二个集合,存储两个总和 sum1 和 sum2 ,分别表示每个集合中值的总和。 一旦到达数组的末尾,我们返回这两个总和的差值。 # 2026-01-30 Graphs #穷举搜索 #递归
use_python 输入 读入单行 a, b = map(int, input().split()) print(a+b) 读入多行 import sys for line in sys.stdin: list1 = map(int, line.strip().split()) print(sum(list1)) readline() 、readlines() 和 read() 区别 2025-12-16 algorithm
cf 模板 #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.t 2025-09-03 algorithm