文章分类 - 基础算法
摘要:贪心算法 001 P2240 【深基12.例1】部分背包问题 002 P1223 排队接水 003 P1803 凌乱的yyy / 线段覆盖 004 P1090 [NOIP2004 提高组] 合并果子 / [USACO06NOV] Fence Repair G 005 P3817 小A的糖果 006
阅读全文
摘要:贪心算法-过河问题 https://www.luogu.com.cn/problem/P1809 /* 1个 a1 2个 a1+a2 3个 a3+a1+a2 >3 运输左边用时最长的两个人去右边 有两种最优方案 取最小 4个 左 a1 a2 a3 a4 右 a1和a4 --a4 左 a2 a3 右
阅读全文
摘要:上海计算机学会-算法月赛-丙组 2020-03 打渔还是晒网 https://iai.sh.cn/problem/17 数字加密 https://iai.sh.cn/problem/14 双质数 https://iai.sh.cn/problem/11 连乘问题 https://iai.sh.cn/
阅读全文
摘要:2021基础编程练习5-结构体扩展练习 作业统计 http://oj.61coding.cn/problem.php?cid=1029&pid=0 #include<bits/stdc++.h> using namespace std; struct worktime{// 声明一个结构体类型 wo
阅读全文
摘要:C++数据结构-结构体 学生信息 http://oj.61coding.cn/problem.php?cid=1028&pid=0 #include<bits/stdc++.h> using namespace std; struct student{ string name; char sex;
阅读全文
摘要:数字方格 如上图,有3个方格,每个方格里面都有一个整数a1,a2,a3。已知0 ⇐ a1, a2, a3 ⇐ n,而且a1 + a2是2的倍数,a2 + a3是3的倍数, a1 + a2 + a3是5的倍数。你的任务是找到一组a1,a2,a3,使得a1 + a2 + a3最大。 时间限制:1000
阅读全文
摘要:区间和 http://oj.61coding.cn/problem.php?cid=1025&pid=0 #include<bits/stdc++.h> using namespace std; inline int read(){//读入优化 char ch; while((ch=getchar(
阅读全文
摘要:http://noi.openjudge.cn 1.5 循环 16:买房子 17:菲波那契数列 21:角谷猜想 33:计算分数加减表达式的值 35:求出e的值 44:第n小的质数 1.6 一维数组 06:校门外的树 07:有趣的跳跃 1.7 字符串 04:石头剪子布 17:字符串判等 1.9 顺序查
阅读全文
摘要:YACS-202110 运费计算 #include<bits/stdc++.h> using namespace std; int a,ans=12; int main(){ cin>>a; if(a>1000){ int surplus = a-1000; ans+=surplus/500*5;
阅读全文
摘要:小技巧—滚动数组 https://www.cnblogs.com/fusiwei/p/13754119.html https://blog.csdn.net/weixin_45539557/article/details/106904104
阅读全文
摘要:YACS-202109 做烧饼 http://iai.sh.cn/problem/484 #include<bits/stdc++.h> using namespace std; int n,k; int main(){ cin>>n>>k; if(n<k)//如果n<2*k 则需要先烤一面,再烤另
阅读全文
摘要:YACS-202108 阅读竞赛 http://iai.sh.cn/problem/462 #include<bits/stdc++.h> using namespace std; int a,b,x,y; int main(){ cin>>a>>b>>x>>y; int diff=b-a; if(
阅读全文
摘要:布置会场 http://iai.sh.cn/problem/460 #include<bits/stdc++.h> using namespace std; //定义花束数量、三种费用、费用和变量 int x,y,a,b,c,ans; int main(){ cin>>x>>y; cin>>a>>b
阅读全文
摘要:T5 平衡点 分析: 示例代码 #include<bits/stdc++.h> using namespace std; int n; //a 输入数列数 p从第一个到当前元素之和-平衡的前面之和 //s 从某点到最后一个数之和-平衡点后面之和 long long a[100005],p[10000
阅读全文
摘要:YACS-202105 整除 http://iai.sh.cn/problem/440 #include<bits/stdc++.h> using namespace std; int n; int a[100002]; bool b[1000002]; int ans; int main(){ c
阅读全文
摘要:洛谷 P1010 幂次方 -分治算法 https://www.luogu.com.cn/problem/P1010 #include<bits/stdc++.h> using namespace std; void compute(int x){ if (x==0) return; //递归结束条件
阅读全文
摘要:动态规划-完全背包 洛谷 P2722 https://www.luogu.com.cn/problem/P2722 #include<iostream> using namespace std; int x,y; //t每种类型需要时间 p每种类型获得分数 int t[10002],p[10002]
阅读全文
摘要:贪心算法 01背包 洛谷 P1049 --01背包 https://www.luogu.com.cn/problem/P1049 洛谷 P2240 --贪心算法 https://www.luogu.com.cn/problem/P2240
阅读全文
摘要:动态规划01背包-一维数组 洛谷 P1049 https://www.luogu.com.cn/problem/P1049 #include<bits/stdc++.h> using namespace std; //dp数组每个元素可看作为当前下标体积的箱子 int dp[20001],w[31]
阅读全文
摘要:高精度加法 数组的每一位相加 #include<bits/stdc++.h> using namespace std; string gaoPlus(string aa,string bb) { int i, t; if (aa.size() < bb.size()){// 两个字符串的长度不一样,
阅读全文