区间dp+前缀和 #1898: 蓝桥杯算法提高VIP-合并石子(C++) n堆石子,挑选任意一端区间[L,R]我们用F[L,R]表示从L到R合并为一堆所需要的**最小代价**枚举一个切分点,把区间分割为[L,K]-[K+1,R],那么问题就转为合并L->K,K+1->R这两堆石子的代价这其中我们还可以用前缀和数组来快速求合并[L, 题解列表 2024年11月24日 0 点赞 0 评论 428 浏览 评分:0.0
A+B for Input-Output Practice (IV) #includeusingnamespacestd;intmain(){inti=0,n;inta,sum=0;while(cin>>n){if(n==0)break;else{while(i>a;sum+=a;++i;}cout 题解列表 2024年11月24日 0 点赞 0 评论 570 浏览 评分:0.0
安之 用STL模拟栈的方法 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ //3 123 321 //3 123 312 ve…… 题解列表 2024年11月24日 0 点赞 0 评论 461 浏览 评分:0.0
自定义函数之整数处理 摘要:#include<bits/stdc++.h> using namespace std; int main() { int a[10]; for(int i=0;i<10;i++)c…… 题解列表 2024年11月24日 0 点赞 0 评论 524 浏览 评分:9.9
循环单链表 #1770: [编程入门]链表之报数问题&约瑟夫环(C++) 这道题如果用不带头结点的循环单链表会少去两个特判奈何作者带头结点的写习惯了,不带头结点的一时不会写了```#include#defineMAX0x3f3f3f3f#defineMIN-0x3f3f3f3fusingnamespacestd;typedeflonglongll;intn, 题解列表 2024年11月24日 0 点赞 0 评论 575 浏览 评分:0.0
安之 第二小整数 STL解法 摘要:解题思路:用multiset 中对重复元素保留的方法进行编写!使用迭代器输出第二小的元素!注意事项:参考代码: #include <bits/stdc++.h>using nam…… 题解列表 2024年11月24日 0 点赞 0 评论 509 浏览 评分:0.0
3008: 班长用班费买笔 解题思路:尽量买四元的笔剩1元,则4元钱的笔少买1支,换成1支5元笔;剩2元,则4元钱的笔少买1支,换成1支6元笔;剩3元,则4元钱的笔少买2支,换成1支5元笔和1支6元笔;注意事项:参考代码:#includeusingnamespacestd;intmain(){lon 题解列表 2024年11月24日 4 点赞 0 评论 639 浏览 评分:10.0
2749: Hello, World!题解 摘要:解题思路:注意事项:参考代码:#includeusing namespace std;int main(){ cout << "Hello world!" << endl; return …… 题解列表 2024年11月24日 4 点赞 0 评论 1471 浏览 评分:10.0
数字金字塔,记忆化dfs,点进来吧万一就看懂了呢 摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h" using namespace std; // 全局变量声明 int r, sss; // r表示三角形的行数,ss…… 题解列表 2024年11月23日 0 点赞 0 评论 531 浏览 评分:0.0
2950: 素数回文数的个数 ```c#includeusingnamespacestd;constintmaxn=2000010;intprime[maxn];voidjudge_prime(intn){intk=sqrt(n);for(inti=2;in;intt,num, 题解列表 2024年11月23日 0 点赞 0 评论 499 浏览 评分:0.0