![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
洛谷刷题
记录蒟蒻的算法成长
MADAO·
这个作者很懒,什么都没留下…
展开
-
P1017 [NOIP2000 提高组] 进制转换
可以把十以上的数字用ascii值转换成大写字母。原创 2023-02-10 12:11:42 · 172 阅读 · 0 评论 -
P1016 [NOIP1999 提高组] 旅行家的预算
比较简单的普及加,贪心加模拟即可轻松解出。原创 2023-02-10 10:45:41 · 222 阅读 · 0 评论 -
P1518 [USACO2.4]两只塔姆沃斯牛 The Tamworth Two
原想法:结果运行了2秒多,查了下别人的题解大多都只有30至40ms,然后查了下题解发现了个有趣的解法,设置一个专属值记录所有经历过的状态#include<iostream>using namespace std;char arr[12][12];int sum;struct hhh{ int x; int y; int temp;}f, c;void shuru();void ren(hhh&);int main(){ freopen("titl..原创 2022-04-21 22:16:56 · 237 阅读 · 0 评论 -
洛谷[NOIP2009 普及组] 多项式输出
#include<iostream>#include<cmath>#include<cstdio>using namespace std;int k, arr[110],g;//k是最高次数,arr用于存储系数,g用来检测是否是第一位输出的数int main(){ freopen("title.in", "r", stdin); cin >> k; for(int i=1;i<=k+1;i++) cin >> arr[.原创 2022-04-23 10:27:14 · 250 阅读 · 0 评论 -
洛谷P1786 帮贡排序
看注释应该可以明白,不明白可以评论,最近一直在刷模拟题。#include<iostream>#include<algorithm>#include<cstring>using namespace std;struct information//包括名称,职位,帮贡数,等级{ int order_posts;//记录职位大小 int order;//记录原顺序 string name;//名称 string posts;//职位 int valu.原创 2022-04-29 19:46:00 · 142 阅读 · 0 评论 -
洛谷P3654 First Step (ファーストステップ)
#include<iostream>using namespace std;char arr[105][105];int r, c, k,sum;void fuzhi(){ cin >> r >> c >> k; for (int i = 1; i <= r; i++) for (int d = 1; d <= c; d++) cin >> arr[i][d];}int main(){ freopen(.原创 2022-05-04 11:53:26 · 188 阅读 · 0 评论 -
洛谷P1065 [NOIP2006 提高组] 作业调度方案(2022年4月25日第一道普及+/提高)
这次的代码编写真的是思路很清晰,一开始看到题目真的是一头雾水,然后我将每一步要做的事就行拆解,再将每一步需要的数组或变量一个个添加再实现功能就得出答案了,感觉爽爆了。#include<iostream>#include<algorithm>using namespace std;int m, n,order[405];//m为机器数和各个工件的工序数,n为工件数,order为工件安排次序struct steps//工件的工序所对应机器及加工时间{ int gong.原创 2022-04-25 23:06:14 · 540 阅读 · 0 评论 -
洛谷P1098 [NOIP2007 提高组] 字符串的展开
我敲的烂代码:因为不知道使用三目运算符节省代码量,所以写了很多重复代码,不过还是AC了回头看自己的代码,发现我竟然不想看,以后还是要好好写注释。题解还是看大佬的吧#include<iostream>#include<cmath>#include<cstdio>#include<cstring>using namespace std;int p1, p2, p3,i,k,h,len;string arr;int main(){.原创 2022-04-23 21:22:02 · 934 阅读 · 0 评论 -
洛谷P1591 阶乘数码
有问题评论哦,注释应该很清楚啦#include<iostream>#include<algorithm>#include<cstring>using namespace std;int t, outcome[2600] = {1,1}, sum;//t为输入组数,outcome用于存储阶乘结果struct condition{ int n;// n为阶乘数 int a;//a为数码}con[11];int main(){ freopen(".原创 2022-04-29 22:07:53 · 288 阅读 · 1 评论 -
洛谷P1045 [NOIP2003 普及组] 麦森数
#include<iostream>#include<algorithm>#include<cmath>using namespace std;unsigned long long n,result[1000000] = {0,1},result2[1000000];int main(){ freopen("title.in", "r", stdin); cin >> n; unsigned long long int nodigits =.原创 2022-05-02 16:43:16 · 267 阅读 · 0 评论 -
洛谷 P1433 吃奶酪
这是一道入门的状态压缩dp,只要理解了dp是根据不包括这一节点前的集合最短长度进行选择,以及利用二进制码进行状态压缩,表示集合即可解出。状态压缩仅仅是集合,而F这个二维数组则蕴含着顺序,代码中的注释已经很详细了,有问题可以评论区问。原创 2022-09-20 11:51:40 · 106 阅读 · 0 评论 -
洛谷P1149 [NOIP2008 提高组] 火柴棒等式
#include<iostream>using namespace std;int n, num[10] = {6,2,5,5,4,5,6,3,7,6},sum,k;//k用于监视是否有相同数字出现int main(){ freopen("title.in", "r", stdin); cin >> n; n = n - 4;//删去固定开支+和= int tn = n; for (int i = 0; i <800 ; i++)//我找到的最高数据是711.原创 2022-05-04 19:28:54 · 62 阅读 · 0 评论 -
洛谷P3799 妖梦拼木棒 题解
//简单的思路:四根必有两根相同,所以咱们就先选两根组合成第三根,确定另外相同的两根的长度//分为两种情况,一、预选两根相同长度。二、预选两根不同长度。//所有情况是预选*(确定的另外两根)#include<iostream>using namespace std;long long int n,arr[5500],temp,sum;int maxn;void shuru(){ cin >> n; for (int i = 1; i <= n; i++).原创 2022-05-04 22:11:47 · 402 阅读 · 0 评论 -
洛谷P2036 [COCI2008-2009#2] PERKET 题解(不用递归和用递归的区别。。)
简单思路:n这么小,第一想到的就是暴力,于是就发生了这种事。。。。#include<iostream>#include<cmath>using namespace std;int n,sum,res=100000000;struct sour_bitter{ int sour; int bitter;}arr[12];int main(){ cin >> n; for (int i = 1; i <= n; i++) cin .原创 2022-05-05 19:53:16 · 314 阅读 · 0 评论 -
洛谷P1259 黑白棋子的移动 题解
给我整无语了。。。。。。。。。。。。。。#include<iostream>#include<cmath>using namespace std;/*oooo****--ooo--***o*ooo*o**--*o--*o**oo*o*o*o*--o*--o*o*o*o**/int n;char arr[300];void chessman(int g){ if (g > 4) { if (g != n) { for (int.原创 2022-05-14 15:50:37 · 224 阅读 · 0 评论 -
洛谷P1443 马的遍历
#include<iostream>#include<algorithm>#include<queue>#include<cstring>using namespace std;int n, m, xs, ys;int arr[8][2] = { {-1,-2},{-2,-1},{-2,1},{-1,2},{1,2},{2,1},{2,-1},{1,-2} };//马的八条路线int horse[450][450];//记录坐标处的最少步数st原创 2022-05-29 11:16:58 · 140 阅读 · 0 评论