![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
贪心算法
栗子栗子栗子栗子
这个作者很懒,什么都没留下…
展开
-
删数问题(挖
#include <iostream>#include <cstdio>#include <algorithm>#include <string>#include <string.h>using namespace std;int main() { string s; long long int k; cin >> s; cin >> k; int len = s.length(); while (原创 2020-11-30 01:10:43 · 109 阅读 · 0 评论 -
线段覆盖(挖
#include <stdio.h>#include <algorithm>#include <iostream>using namespace std;struct oj { int b; int e;};bool cmp(oj a, oj b) { return a.e < b.e;}int main() { int n; scanf("%d", &n); struct oj a[n]; for (int i = 0;原创 2020-11-30 01:07:25 · 115 阅读 · 0 评论 -
部分背包问题(挖
#include <algorithm>#include <stdio.h>using namespace std;struct bag { double w; double v; double wv;};bool cmp(bag a, bag b) { return a.wv > b.wv;}int main() { int n, m; scanf("%d%d", &n, &m); struct bag a[n]; for原创 2020-11-30 01:06:34 · 105 阅读 · 0 评论 -
洛谷 P1781 宇宙总统(字符串比大小)
题目描述地球历公元 6036 年,全宇宙准备竞选一个最贤能的人当总统,共有 n 个非凡拔尖的人竞选总统,现在票数已经统计完毕,请你算出谁能够当上总统。输入格式第一行为一个整数 n,代表竞选总统的人数。接下来有 n 行,分别为第一个候选人到第 n个候选人的票数。输出格式共两行,第一行是一个整数 m,为当上总统的人的号数。第二行是当上总统的人的选票。说明/提示票数可能会很大,可能会到 100100 位数字。(1≤n≤20)样例输入598765123658795410223569原创 2020-11-26 15:50:13 · 153 阅读 · 0 评论