2.16普及组打卡题目

cloud、泡泡 cloud、泡泡 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

奶牛

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> PII;
#define x first
#define y second
#define ms(a,s) memset(a, s, sizeof a);
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
const int mod = 1e6+7;
const int inf = 0x3f3f3f3f;
const int N = 5e4 + 10;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
struct node {
	int w, s;
}a[N];
bool cmp(node a, node b) {
	return a.w + a.s < b.w + b.s;
}
void solve() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++ ) {
		cin >> a[i].w >> a[i].s;
	}
	sort(a + 1, a + 1 + n, cmp);
	int ans = -1e6, k = 0;
	for(int i = 1; i <= n; i ++ ) {
		ans = max(ans, k - a[i].s);
		k += a[i].w;
	}
	cout << ans;
}
int main()
{
	int t = 1;

//	cin >> t;

	while(t --) {
		solve();
	}

	return 0;
}

nasa

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> PII;
#define x first
#define y second
#define ms(a,s) memset(a, s, sizeof a);
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
const int mod = 1e6+7;
const int inf = 0x3f3f3f3f;
const int N = 1010;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int a[N], w[N], v[N], f[N][N];
void solve() {
	int h, t, n;
	cin >> h >> t >> n;
	for(int i = 1; i <= n; i ++ ) {
		cin >> w[i] >> v[i] >> a[i];
	}
	for(int i = 1; i <= n; i ++ ) {
		for(int j = h; j >= w[i]; j -- ) {
			for(int k = t; k >= v[i]; k -- ) {
				f[j][k] = max(f[j][k], f[j - w[i]][k - v[i]] + a[i]);
			}
		}
	}
	cout << f[h][t];
}
int main()
{
	int t = 1;

//	cin >> t;

	while(t --) {
		solve();
	}

	return 0;
}

 

...全文

相关推荐

逸尚YSK-1280 打卡钟快速设置手册

逸尚YSK-1280 打卡钟快速设置手册

ieuili

python打卡DAY16

python打卡DAY16

Bugabooo

Python + selenium + crontab实现每日定时自动打卡功能

主要介绍了Python + selenium + crontab实现每日定时自动打卡功能,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

weixin_38703277

leetcode跳跃-LeetCode:LeetCode刷题打卡

leetcode 跳跃 LeetCode LeetCode刷题打卡 2020.02.04 回溯算法 编号 难度 题目 题解思路 执行结果 401 简单 二进制手表 回溯算法 40 ms 13.2 MB 784 简单 字母大小写全排列 回溯算法 64 ms 13.5 MB 2020.02.05 数组 编号 难度 题目 题解思路 执行结果 1 简单 两数之和 [1] 暴力法[2] 两遍哈希表 [1] 7608 ms 14.2 MB[2] 56 ms 14.9 MB 11 中等 盛最多水的容器 [1] 暴力法[2] 双指针 [1] 超出时间限制[2] 160 ms 27.1 MB 15 中等 三数之和 排序 遍历+双指针 736 ms 16.6 MB 18 中等 四数之和 排序 双循环遍历+双指针 164 ms 13 MB 2020.02.06 数组 编号 难度 题目 题解思路 执行结果 4 困难 寻找两个有序数组的中位数 合并 排序 128 ms 13.2 MB 16 中等 最接近的三数之和 排序 遍历+双指针 100 ms 13.3 MB 26 简单 删除排序数组中的重复项 [1] 复制

weixin_38505158

基于因子分析的“打卡返现”现象研究

基于因子分析的“打卡返现”现象研究

超级源码阿
评论 6
收藏 已收藏
分享
返回顶部
cloud、泡泡
cloud、泡泡 优质创作者: 云计算技术领域 优质创作者: 云计算技术领域
高校算法学习社区 51,727 成员 6,062 内容