pat 1090
原创 2022-02-03 09:23:28
10000+阅读
1 class Solution: 2 def largestValsFromLabels(self, values: 'List[int]', labels: 'List[int]', num_wanted: int, use_limit: int) -> int: 3 dic = {} 4 for i in range(len(label
转载 2019-06-16 15:10:00
63阅读
1090. Highest Price in Supply Chain (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A supply chain is a network
原创 2022-08-30 10:12:31
34阅读
Description2n=C(n,0)+C(n,1)+…+C(n,n)。其中表示幂,C(n,x)表示组合数,即C(n,x)=n!/((n-x)!x!)。现在给你n(0<=n<=33)
原创 2022-08-08 20:17:47
50阅读
A+B for Input-Output Practice (II):#include<iostream> using namespace std; int main(){ int n; cin>>n; while(n--){ int a,b; cin>>a>>b;
原创 2013-07-27 17:50:48
1366阅读
http://acm.timus.ru/problem.aspx?space=1&num=1090 1 #include 2 #include 3 #include 4 #define maxn 20000 5 using namespace std; 6 7 int c[maxn],n,a[maxn]; 8 int lowbit(int x) 9 {10 return x&(-x);11 }12 13 void add(int pos)14 {15 while(pos0)26 {27 sum+=c[pos];28 pos-=lo...
转载 2014-03-21 17:17:00
57阅读
2评论
// 题意:找出最小生成树的最大边#include<iostream> //最小生成树Prim算法using namespace std;struct MST //最小生成树的边{ int st,ed,w;}mst[1000];int n,edge[1000][1000];int ans; //ans保存最小生成树的最长边void Prim(){ int i,j,k; for(i=0;i<n-1;i++) //默认选择节点0加入生成树 { mst[i].st=0;mst[i].ed=i+1; mst[i...
转载 2011-07-12 16:33:00
59阅读
题目题意:给一棵树,在树根出货物的价格..
原创 2023-06-27 10:22:42
61阅读
#include <iostream>#include <iomanip>#include <cmath>using namespace std;const double PI = 3.141592653589793;double Distance(double x1,double y1,double x2,double y2){//两点间的距离    doub
原创 2021-08-05 14:43:49
89阅读
题目#include<iostream>#include<vector>using namespace std;int main() { int n,m; cin>>n>>m; vector<vector<int>> ans(100003); for(int i=0; i<n; ++i) {//建立...
原创 2023-06-27 10:18:26
54阅读
题目传送门 总结: 1、哈夫曼编码模板题 2、使用了STL中的优先队列 小根堆 priority_queue<int, vector<int>, greater<int> > q; 默认大根堆 priority_queue<int, vector<int>> q; 可多知识可以参考:https://
转载 2021-08-11 09:38:08
135阅读
题目描述在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成
原创 2023-01-03 11:44:48
88阅读
n^3dp。貌似写麻烦了。。。
转载 2016-10-30 22:58:00
56阅读
2评论
1.题目https://pintia.cn/problem-sets/994805342720868352/problems/994805388447170560给出一棵树,求出叶子结点“带权路径”之和,这里不是以前那种带权,叶子结点真正的权值由该结点的深度决定(幂次方)。看懂题目的输入,每行开头为当前结点i的叶子结点个数,若该首数字非0,则该行后面的数字都为i结点的叶子结
原创 2022-07-14 10:29:53
2阅读
题目传送门 二分 + 滑动窗口 1、给定某个长度,若该长度满足条件,就变长继续观察,不满足则变短继续观察,直到找到最小符合的长度值,因此使用二分 2、$check$函数中,给定最长的空题段的长度是$mid$,求出满足题意的花费时间最小值$res$,判断$res ⇐ t$是否成立 3、由于最长的空题段
原创 2022-02-15 14:30:22
104阅读
P1090 合并果子题目描述在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。每一次合并,多多
原创 2022-10-18 16:18:59
74阅读
1090 危险品装箱(JAVA)
原创 2022-10-17 17:59:35
81阅读
Rock, Paper, Scissors时间限制(普通/Java):1500 MS/10000 MS 运行内存限制 : 65536 KByte总提交 : 230 测试通过 : 107题目描述Rock, Paper, Scissors is a classic hand game fo...
转载 2015-04-15 12:27:00
91阅读
2评论
Two Prefixes 在纸上画了画感受一下可以感觉和循环节有关, 我们把每个可以表示的串写成 pre_a_i + pre_b_j的形式, 我们使得每个串在 i 最大的时候被统计到, 那么我们考虑答案为n * m - 重复的串个数, 对于pre_a_i + pre_b_j 这个串, 我们记b[0]
转载 2019-10-21 21:56:00
97阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5