机缘

最初,我只是想通过发布博客来巩固自己的知识,比如我刚打完一场算法比赛后,我会将不会的题目搞懂后在博客上重新回顾一遍,再比如我新学习了一个知识点或者容易遗忘的知识点,我会在博客上进行总结。经过长时间的积累,已经有了写博客的习惯,这不仅可以让我巩固知识,还可以为初学者提供学习的条件。


收获

获得了一些粉丝的关注和私信,比如催我更新。在此期间写博客的收获很多,既让我回顾了知识,又可以通过这种方式将我总结的结果记录下来,还可以供其他小伙伴学习,益处很多


日常

创作已经是我生活中的一部分,新学到的东西总是想把他记录下来发表一下,总之,很有意义


成就

1.整理了知识点

2.整理了比赛的思路

代码最多的一道:天梯赛中的一道题

#include<bits/stdc++.h>
#define IOS std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long
#define endl "\n"
using namespace std;
struct node {
	string name;
	int num;
	int sai;
	int sainum[60];
	int xu;
}sch;
int n, c;
struct cmp1{
	bool operator() (const node& a, const node& b)
	{
		return a.num < b.num;	
	}
};
bool cmp(node a1, node a2) {
	return a1.xu < a2.xu;
}
priority_queue<node, vector<node>, cmp1> q;
signed main()
{
	IOS;
	int sum = 0;
	cin >> n >> c;
	for (int i = 0; i < n; i++) {
		cin >> sch.name >> sch.num;
		sch.xu = i;
		q.push(sch);
		sum += sch.num;
	}
	while (q.top().num != 0) {
		node now = q.top();
		q.pop();
		if (now.num >= c) {
			now.sai++;
			now.sainum[now.sai] = c;
			now.num -= c;
		}
		else if (n < c) {
			int flag = 0;
			for (int i = 1; i <= now.sai; i++) {
				if (c - now.sainum[i] >= n) {
					flag = 1;
					now.sainum[i] -= n;
					now.num -= n;
					break;
				}
			}
			if (flag == 0) {
				now.sai++;
				now.sainum[now.sai] = n;
				now.num -= n;
			}
		}
		q.push(now);
	}
	vector<node>pp;
	while (q.size()) {
		pp.push_back(q.top());
		q.pop();
	}
	sort(pp.begin(),pp.end(), cmp);
	for (auto p : pp) {
		cout << p.name << " " << p.sai << endl;
	}
	if (sum % c == 0) {
		cout << sum / c << endl;
	}
	else {
		cout << sum / c + 1 << endl;
	}
	return 0;
}

憧憬

希望可以早日找到一份优质的工作!

Tips

  1. 您发布的文章将会展示至 里程碑专区 ,您也可以在 专区 内查看其他创作者的纪念日文章
  2. 优质的纪念文章将会获得神秘打赏哦