[金银岛]自定义排序优先'均权'最大--我看题解都太复杂辣 #贪心自定义排序找均权值最大####好久没发题解了。。。#####核心思路:通过价值/重量得到单位价值######按照单位价值从大到小得顺序装直到装不下为止#####**金属可切割######若装不下整个金属那么就能装多少装多少按照价值/重量*能装下得重量######ACCode:```cpp#inc 题解列表 2024年10月20日 0 点赞 1 评论 669 浏览 评分:9.9
题可以贪心做,人要看准了爱. #权重=价值/重量就是先拿(价值/重量)权重最大的,最后拿不下了就分割(权重*剩下背包重量)拿走就行了```cpp#include#defineULLunsignedlonglong#defineintlonglong#defineendl'\n'#definedebug(a)coutc[i].v;c 题解列表 2024年10月21日 0 点赞 2 评论 616 浏览 评分:9.9
1177: 三角形 摘要:解题思路:注意事项:参考代码:t = int(input())for x in range(t): n = int(input()) l = [] l = [ list(map(in…… 题解列表 2024年10月21日 1 点赞 0 评论 494 浏览 评分:0.0
2835: 计算书费 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ double arr[100],sum=0,brr[100]; brr[0]=28.9; br…… 题解列表 2024年10月21日 0 点赞 0 评论 647 浏览 评分:9.9
搭配购买(buy) 并查集+01背包dp问题 #includeusingnamespacestd;constintN=1e4+5;intfather[N];intvalue[N],cost[N];intdp[N];intn,m,w;intfind(intx){if(father[x]!=x){x=find(father[x]);}returnfa 题解列表 2024年10月21日 1 点赞 0 评论 520 浏览 评分:9.9
亲戚 并查集+人数求和 #includeusingnamespacestd;intn,m,a,b;charc;structrelation{intfa,cnt;};relationf[100010];voidinit(){for(inti=1;i>n>>m;init();while(m--){cin>>c;if(c=='M' 题解列表 2024年10月21日 0 点赞 0 评论 457 浏览 评分:9.9
亲戚 并查集+人数求和 #includeusingnamespacestd;constintMAXN=100010;intfa[MAXN],size[MAXN];intn,m;charc;voidinit(){for(inti=1;i>n>>m;init();while(m--){cin>>c;if(c=='M'){inta 题解列表 2024年10月21日 1 点赞 0 评论 556 浏览 评分:9.9
蓝桥杯2024年第十五届省赛真题-封闭图形个数(C++) 摘要:解题思路:不使用结构体,而使用vector向量作为不同个数封闭图形的存放处,好处就是不限制同一个数封闭图形的次数。注意事项:sort(num[i].begin(), num[i].end());是对每…… 题解列表 2024年10月22日 1 点赞 0 评论 1165 浏览 评分:9.9
[信息学奥赛一本通T1541-数列区间最大值] ST表 #线段树常数大了得加点小细节才能过(~~反正我没过~~),静态询问嘛,就用ST表就行```cpp#include#defineULLunsignedlonglong#defineintlonglong#defineendl'\n'#definedebug(a)cout 题解列表 2024年10月22日 0 点赞 0 评论 488 浏览 评分:9.9
1039: [编程入门]宏定义之闰年判断(python) ####~~~pythondefislun(n):ifn%4==0andn%100!=0:return'L'ifn%400==0:return'L'return'N'defmain():n=int(input())print(islun(n))if__name__=='__main__':main() 题解列表 2024年10月22日 0 点赞 0 评论 1196 浏览 评分:9.9