- 博客(71)
- 资源 (1)
- 收藏
- 关注
原创 STM32 IIC(硬件和软件)读取AT24C02
一:IIC介绍IIC协议原理和时序图分析这里就不说了附一个链接IIC基本原理讲的很清楚IIC基本原理连接https://blog.youkuaiyun.com/qq_38410730/article/details/80312357下面直接上干货IIC软件驱动和硬件驱动二:软件驱动IIC 驱动头文件#ifndef _IIC_H#define _IIC_H#include ...
2019-07-20 20:07:49
2390
3
原创 STM32第一篇点灯
一:点灯初始化用到的库函数1. /*开启LED相关的GPIO外设时钟*/ void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)参数 1 RCC_APB2Periph /* GPIO端口时钟 */参数2 NewState ...
2019-07-04 23:31:11
3588
原创 CT107D(蓝桥杯)开发板液晶模块的使用
一:液晶模块LCD1602只能显示字符不能显示图片和汉字;引脚相对应的功能如下:E管脚对应的单片机的管脚为P1^2;R/W对应的管脚为P2^1;RS对应的管脚为P2^0;VL是接接旁边的电位器RB1的,通过RB1可以控制液晶的显示暗和亮情况;二:液晶的写命令和写数据的方法:dat 要写入的数;当RS=0;的时候写入的是命令当RS=1;的时候写入的是数据void LCD_COM(...
2019-03-30 16:51:31
2812
9
原创 CT107D(蓝桥杯)开发板超声波模块
超声波模块测距的简单写法:1 :简单原理;通过P10引脚发送8个40KHZ的脉冲之后开始定时器1开始计时;当P11端口收到信号的时候停止计时;因为声音在空气传播的速度为340m/s,又因为单片机一个机器周期(就是定时器计一次时间)大概是1us;所以每us的距离大概为340*10^3cm/10^6;因为声音经过反射才使P11端口接收到信号;所以结果要除以2;得到是0.017cm/us;因为声音在...
2019-03-29 21:54:26
1474
原创 蓝桥杯第十届单片机总结
https://blog.youkuaiyun.com/qq_37429313/article/details/86929724这是一篇介绍蓝桥杯板子方波N555模块的博客我自己的理解是将定时器0设置为计数模式,定时器1设置为计时模式来定1S的时间,然后定时器0记录的次数就是频率。怎么设置呢只需要将TMOD设置为TMOD=0x04即可寄存器TMOD高四位是设置定时器1工作方式,低四位是设置定时...
2019-03-26 13:29:33
6960
4
原创 I - 扩展欧几里得! CodeForces - 7C
A line on the plane is described by an equationAx + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018to5·1018inclusive, or to find out that s...
2018-09-26 18:18:36
250
原创 V - Maximum GCD UVA - 11827
Given theNintegers, you have to find the maximum GCD(greatest common divisor) of every possible pair of these integers.InputThe first line of input is an integerN(1<N<100) that determines...
2018-09-02 21:34:47
266
原创 A - 深海探险 51Nod - 1535
很久很久以前的一天,一位美男子来到海边,海上狂风大作。美男子希望在海中找到美人鱼,但是很不幸他只找到了章鱼怪。然而,在世界的另一端,人们正在积极的收集怪物的行为信息,以便研制出强大的武器来对付章鱼怪。由于地震的多发,以及恶劣的天气,使得我们的卫星不能很好的定位怪物,从而不能很好的命中目标。第一次射击的分析结果会反映在一张由n个点和m条边组成的无向图上。现在让我们来确定这张图是不是可以被认...
2018-09-02 20:42:27
167
原创 G - Line CodeForces - 7C
A line on the plane is described by an equationAx + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018to5·1018inclusive, or to find out that su...
2018-09-02 20:30:53
182
原创 A - Bi-shoe and Phi-shoe LightOJ - 1370
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go...
2018-09-02 20:09:50
205
原创 F - Super Jumping! Jumping! Jumping! HDU - 1087
Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game ...
2018-08-26 21:24:45
143
原创 A - Robot Rapping Results Report CodeForces - 645D
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition re...
2018-08-26 20:59:17
189
原创 E - 超级密码 HDU - 1226
Ignatius花了一个星期的时间终于找到了传说中的宝藏,宝藏被放在一个房间里,房间的门用密码锁起来了,在门旁边的墙上有一些关于密码的提示信息: 密码是一个C进制的数,并且只能由给定的M个数字构成,同时密码是一个给定十进制整数N(0<=N<=5000)的正整数倍(如果存在多个满足条件的数,那么最小的那个就是密码),如果这样的密码存在,那么当你输入它以后门将打开,如果不存在这样的密码....
2018-08-26 20:46:01
236
原创 D - Anniversary party POJ - 2342
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...
2018-08-26 20:07:20
179
原创 B - S-Trees UVA - 712
DescriptionA Strange Tree (S-tree) over the variable set Xn = {x1,x2,...,xn} is a binary tree representing a Boolean function f:{0,1}->{0,1}. Each path of the S-tree begins at the root node and c...
2018-08-26 19:49:41
208
原创 F - 度度熊学队列 HDU - 6375
度度熊正在学习双端队列,他对其翻转和合并产生了很大的兴趣。 初始时有 NN 个空的双端队列(编号为 11 到 NN ),你要支持度度熊的 QQ 次操作。 ①11 uu ww valval 在编号为 uu 的队列里加入一个权值为 valval 的元素。(w=0w=0 表示加在最前面,w=1w=1 表示加在最后面)。 ②22 uu ww 询问编号为 uu 的队列里的某个元素并删除它。( w=0w...
2018-08-26 19:39:07
193
原创 D - The Falling Leaves UVA - 699
Each year, fall in the North Central region is accompanied by the brilliant colors of the leaves on the trees, followed quickly by the falling leaves accumulating under the trees. If the same thing ha...
2018-08-26 19:15:35
216
原创 B - Not so Mobile UVA - 839
Before being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. This kind of mobile is usually found hanging over cradles of small...
2018-08-26 17:09:14
174
原创 E - The order of a Tree HDU - 3999
As we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely: 1. insert a key k to a empty tree, then the tree become a tree with only one node; ...
2018-08-26 16:11:53
191
原创 A - 二叉搜索树 HDU - 3791
判断两序列是否为同一二叉搜索树序列Input开始一个数n,(1<=n<=20) 表示有n个需要判断,n= 0 的时候输入结束。接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。Output如果序列相同则...
2018-08-26 15:55:10
217
原创 D - Functions again CodeForces - 789C
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arr...
2018-08-19 21:39:12
256
原创 C - Mr. Kitayuta's Colorful Graph CodeForces - 505B
Mr. Kitayuta has just bought an undirected graph consisting of n vertices and medges. The vertices of the graph are numbered from 1 to n. Each edge, namely edge i, has a color ci, connecting vertex ai...
2018-08-19 21:24:39
210
原创 B - Tree Recovery POJ - 2255
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes. This is an example of one of her creati...
2018-08-19 21:09:31
194
原创 F - Elven Postman HDU - 5444
Elves are very peculiar creatures. As we all know, they can live for a very long time and their magical prowess are not something to be taken lightly. Also, they live on trees. However, there is somet...
2018-08-19 20:59:50
200
原创 E - Fox And Names CodeForces - 510C
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographicalorder.After ...
2018-08-16 21:31:51
166
原创 B - Slim Span POJ - 3522
Given an undirected weighted graph G, you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, …, vn} and E is a set of...
2018-08-16 20:44:03
186
原创 A - Minimum Transport Cost HDU - 1385
These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transpor...
2018-08-16 20:30:52
172
原创 A - Ice_cream's world I HDU - 2120
ice_cream's world is a rich country, it has many fertile lands. Today, the queen of ice_cream wants award land to diligent ACMers. So there are some watchtowers are set up, and wall between watchtower...
2018-08-16 20:19:37
271
原创 I - Wormholes POJ - 3259
While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that i...
2018-08-14 20:21:11
273
原创 H - Play on Words POJ - 1386
Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very impo...
2018-08-14 20:07:44
216
原创 F - 确定比赛名次 HDU - 1285
有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。 Input输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表...
2018-08-14 19:54:49
113
原创 D - 六度分离 HDU - 1869
1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degrees of separation)。虽然米尔格兰姆的理论屡屡应验,一直也有很多社会学家对其兴趣浓厚,但是在30多年的时间...
2018-08-14 19:39:49
236
原创 C - 最短路径问题 HDU - 3790
给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。 (1<n<=1000, 0<m&...
2018-08-14 19:31:04
174
原创 F - 数组的最大代价 51Nod - 1270
数组A包含N个元素A1, A2......AN。数组B包含N个元素B1, B2......BN。并且数组A中的每一个元素Ai,都满足1 <= Ai <= Bi。数组A的代价定义如下: (公式表示所有两个相邻元素的差的绝对值之和)给出数组B,计算可能的最大代价S。Input第1行:1个数N,表示数组的长度(1 <= N <= 50000)。 第...
2018-08-09 20:38:52
157
原创 E - Is It A Tree? POJ - 1308
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. There ...
2018-08-09 20:16:05
177
原创 B - 小希的迷宫 HDU - 1272
上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的...
2018-08-09 20:12:07
170
原创 F - 搬寝室 HDU - 1421
搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会很累,因为2*k也不小是一个不大于n的整数.幸运的是xhd根据多年的搬东西的经验发现每搬一次的疲劳度是和左右手的物品的重量差的平方成正比(这里补充...
2018-08-05 21:38:44
197
原创 M - FatMouse's Speed HDU - 1160
FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence...
2018-08-05 21:19:24
130
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人