Update \(\texttt{2021.6.24}\) 修改了一处格式上的错误和一处笔误. Content 已知用 LED 灯来显示 \(0\sim9\) 这十个数字分别需要 \(6,2,5,5,4,5,6,3,7,6\) 段 LED 灯管组成,现在,你需要点亮正好 \(n\) 段 LED 灯管,使得组成的数字的和最大. 数据范围:\(2\leqslant n\leqslant 2\times 10^5\). Solution 我们不妨用 \(\dfrac{\text{数字}}{\text{…
听说这里可以做一些idea比较好的题.. 那就做做吧 2017-2018 ACM-ICPC, NEERC, Northern Subregional Contest A. Auxiliary Project 有$7$就要$7$ 余$1$就少一个$7$多一个$4$,余$2$就多一个$1$ #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using name…
A. Auxiliary Project 完全背包. #include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue>…
本文将同步发布于: 洛谷博客: csdn: 博客园: 简书. 题目 题目链接:洛谷 P7028.gym101612J. 题意概述 有一个长度为 \(n\) 的数列,第 \(i\) 个元素的值为 \(a_i\),其中 \(a_i\neq 0\),定义 \(P\) 为数列中所有正整数的和,\(N\) 为所有负整数的和.定义一个元素的重要值 \(w_i=\begin{cases}\dfrac{a_i}{P}&a_i>0\\ \dfrac{a_i}{|N|}&\text{otherwise}…
本文将同步发布于: 洛谷博客: csdn: 博客园: 简书. 题目 题目链接:洛谷 P7025.gym101612G. 题意概述 给你一张有 \(n\) 个点 \(m\) 条边的无向图,无重边无自环,请你求出两个点 \(s,t\) 使得 \(s,t\) 之间有三条不重合的简单路径. \(1\leq\sum n,\sum m\leq 10^5\) 题解 探究图的性质 考虑到本题是无向图,我们不难想到一个引理. 引理:无向图的 dfs 树上只存在树边和返祖边. 考虑到 dfs 树中只会存在树边.返祖…
solution: 最小割问题. 建如下边: (S,i,Ai)代表选用A语言编写第i个项目: (i,T,Bi)代表选用A语言编写第i个项目: 其后注意要反向连边 (i,j,D)代表选用B语言编写第i个项目,选用A语言编写第j个项目: (j,i,C)代表选用A语言编写第i个项目,选用B语言编写第j个项目: litc学长出的题,引文最小割题目做的少,想的少,考试时一直没写出来,按题解自己写了个ISAP,已通过所有测试点. #include<cstdio> #include<cstdlib&g…
转载请注明出处. 前言:  本实验来自斯坦福大学cs140课程,只限于教学用途,以下是他们对于Pintos系统的介绍:  Pintos is a simple operating system framework for the 80x86 architecture. It supports kernel threads, loading and running user programs, and a file system, but it implements all of these in…
目录 描述 解法一:双队列,入快出慢 思路 入栈(push) 出栈(pop) 查看栈顶元素(peek) 是否为空(empty) Java 实现 Python 实现 解法二:双队列,入慢出快 思路 入栈(push) 出栈(pop) 查看栈顶元素(peek) 是否为空(empty) Java 实现 Python 实现 解法三:单队列 思路 入栈(push) 出栈(pop) 查看栈顶元素(peek) 是否为空(empty) Java 实现 Python 实现 更多 LeetCode 题解笔记可以访问我…
project euler 169 题目链接:https://projecteuler.net/problem=169 参考题解:http://tieba.baidu.com/p/2738022069 #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(i…
Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus, he proposed the highway project. The Marjar Empire has N cities (including the capital)…