摘要: 典型的双指针算法: 先将男、女魅力值排序,如果可以搭档,那是最好。若不能,就调魅力值小的那一边。 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; int n, m, j = 1, i = 阅读全文
posted @ 2022-02-05 21:26 福宝j 阅读(73) 评论(0) 推荐(1) 编辑
摘要: 由于 \(a\)、\(b\)、\(n\)、\(x\)、\(y\) 都是非负整数,所以 \(n≤1000\) 的话 \(x,y ≤ 1000\)。 数据范围并不大,我们直接枚举从 \(1 \sim 1000\) 枚举 \(x\)、\(y\) 就行。 #include <iostream> #inclu 阅读全文
posted @ 2022-02-05 20:19 福宝j 阅读(38) 评论(0) 推荐(0) 编辑