llllmz

导航

2024年2月3日

A Knight's JourneyC++

摘要: 题目看半天看不懂。 題目把我恶心坏了。看网上说按字典顺序输出,到底是什么意思半天没搞懂。 #include<iostream> #include<string> using namespace std; int d[8][2]={ {-1,-2},{1,-2},{-2,-1},{2,-1},{-2, 阅读全文

posted @ 2024-02-03 23:05 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

Find The MultipleC++

摘要: 这题就是找N的倍数m,M要求是由1和0组成且非0。 可以用图来看,从1出发临边是1和0,然后广度遍历,第一个能能整除N的数输出就行。 #include<iostream> #include<queue> using namespace std; int main(){ int n=-1; while 阅读全文

posted @ 2024-02-03 16:35 神奇的萝卜丝 阅读(20) 评论(0) 推荐(0)

2024年1月30日

Catch That CowC++

摘要: 其实可以看作一个图,源点是5,5的邻边分别是6,4,10(三种走法),利用BFS,最先遍历17为最少时间。 #include<iostream> #include<queue> #include<vector> using namespace std; struct node{ int data; 阅读全文

posted @ 2024-01-30 22:32 神奇的萝卜丝 阅读(15) 评论(0) 推荐(0)

KY146 魔咒词典C

摘要: #include<stdio.h> #include<string.h> struct node{ char a[100]; char b[100]; }; typedef struct node dir; dir s[100000]; int main(){ char A[200]; int to 阅读全文

posted @ 2024-01-30 20:25 神奇的萝卜丝 阅读(52) 评论(0) 推荐(0)

KY146 魔咒词典C++

摘要: 构建一个map,还是查找问题。 麻烦点就是要 分解输入的过程 #include<iostream> #include<string> #include<map> using namespace std; int main(){ string a,b; map<string,string> m; wh 阅读全文

posted @ 2024-01-30 19:54 神奇的萝卜丝 阅读(30) 评论(0) 推荐(0)

KY27 查找学生信息C

摘要: 简单的结构体查找。要注意C语言中文字符占多个字节,输入输出中文要用%s。 #include<stdio.h> #include<string.h> struct node{ char n[1001]; char name[200]; char x[4]; int age; }; typedef st 阅读全文

posted @ 2024-01-30 17:34 神奇的萝卜丝 阅读(12) 评论(0) 推荐(0)

KY27 查找学生信息C++

摘要: 用map做查找就行了。 #include<iostream> #include<string> #include<map> using namespace std; struct node{ string name; string x; int age; }; typedef struct node 阅读全文

posted @ 2024-01-30 16:51 神奇的萝卜丝 阅读(14) 评论(0) 推荐(0)

2024年1月26日

KY188 哈夫曼树C++

摘要: 用(优先队列)小根堆,先构建哈夫曼树,然后在递归遍历输出WPL。 #include<iostream> #include<queue> using namespace std; struct node{ int data; struct node* left; struct node* right; 阅读全文

posted @ 2024-01-26 20:16 神奇的萝卜丝 阅读(21) 评论(0) 推荐(0)

2024年1月25日

KY196 复数集合C

摘要: C的思路就是,先把用数据录入,然后按要求选出最大(用选择排序是最简单的),最后输出。 #include<stdio.h> #include<math.h> struct node{ int a; int b; long sum; }; typedef struct node num; int cha 阅读全文

posted @ 2024-01-25 17:25 神奇的萝卜丝 阅读(28) 评论(0) 推荐(0)

KY196 复数集合C++

摘要: 这题难点就是什么是复数的模了吧。 然后C++写个优先队列(大根堆)+操作符重载就行了。 #include<iostream> #include<string> #include<queue> #include<math.h> using namespace std; struct node{ int 阅读全文

posted @ 2024-01-25 15:36 神奇的萝卜丝 阅读(24) 评论(0) 推荐(0)