自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(62)
  • 收藏
  • 关注

原创 msp430g2553的IIC通信

因为一个特殊的原因,必须用msp430g2553实现IIC通信,硬件的没弄出来,想软件模拟一下,结果本来预计一晚上的任务,硬生生变成了一晚上加一早上。。。。这块单片机IIC通信的主要槽点在于,你一旦把SDA引脚切换成输入模式进行ACK检测就会直接断开整个时序,我不是很懂为什么,反正我把它去了就好了,下面是根据山外的SCCB底层库改编的msp430g2553的IIC通信代码./**IIC.c**/

2017-11-26 22:37:09 3632

原创 HDU 3987 Harry Potter and the Forbidden Forest

DescriptionHarry Potter notices some Death Eaters try to slip into Castle. The Death Eaters hide in the most depths of Forbidden Forest. Harry need stop them as soon as. The Forbidden Forest

2016-08-31 11:18:24 265

原创 hdu3388 Coprime 二分+容斥原理

DescriptionPlease write a program to calculate the k-th positive integer that is coprime with m and n simultaneously. A is coprime with B when their greatest common divisor is 1.Input

2016-08-26 17:01:53 591

原创 HDU 4405 Aeroplane chess(概率DP求期望)

DescriptionHzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a dice have six faces with equal probabil

2016-08-26 15:09:15 430

原创 HDU 4034 Graph

DescriptionEveryone knows how to calculate the shortest path in a directed graph. In fact, the opposite problem is also easy. Given the length of shortest path between each pair of vertexes, can y

2016-08-25 15:14:20 212

原创 HDU 4028 The time of a day

DescriptionThere are no days and nights on byte island, so the residents here can hardly determine the length of a single day. Fortunately, they have invented a clock with several pointers. They h

2016-08-25 14:09:57 322

原创 HDU 4022 Bombing

DescriptionIt’s a cruel war which killed millions of people and ruined series of cities. In order to stop it, let’s bomb the opponent’s base. It seems not to be a hard work in circumstances of s

2016-08-25 14:08:27 288

原创 POJ 3468 A Simple Problem with Integers 树状数组解法

DescriptionYou have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other i

2016-08-25 14:05:58 197

原创 贪吃蛇self3

这个版本其实没更新啥,就是根据学长的建议写成了工程的形式,还有处理了一些自己发现的bug这个是main.c里的/* 本次目标: 1.实现工程化 2、解决长宽不一样的问题 3,优化部分代码 */#include "uart.h"int main(){ int time=GetTickCount(); int lasttime=time; srand( (unsign

2016-08-23 18:13:00 183

原创 贪吃蛇self2

这个版本的所有更新都写注释了,只是注意要试玩的话不用再全屏了,开始时那个就行。/* 更新计划: 调整屏幕大小 对原来的算法进行优化,除去一些bug; 增加开始画面; 完善图形; 增加颜色; 增加边框; 选择等级;*//* 需要增加下面三个函数 void gotoxy(int x, int y)//设置光标位置 { COORD pos = {x,y}; //定义一

2016-08-23 18:08:41 189

原创 贪吃蛇self1

这是我以前写的贪吃蛇游戏,会有三个版本,从简陋到还算可以吧。是我分别花了三个晚上的时间逐步完善的。第一个版本要试玩的话记得全屏。这一个版本很简陋,就是刷屏,然后不停输出。想法我都写在注释里了。/* 我们先要生成一条蛇,那就用一个类来存,这个类应该包括蛇头, 蛇的身子的各个点的坐标,蛇的移动方向,那现在的问题是要在蛇 尾处增加一段如何处理,(现在想到用一个大的数组储存蛇身就行)

2016-08-23 18:06:55 186

原创 HDU 1394 Minimum Inversion Number 树状数组

DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move the f

2016-08-23 16:58:14 145

原创 POJ 2481 Cows 树状数组

DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good. Fa

2016-08-23 15:44:47 207

原创 POJ 2299 Ultra-QuickSort 树状数组

DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seq

2016-08-23 13:57:36 156

原创 POJ 3067 Japan 树状数组

DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <

2016-08-23 13:12:35 147

原创 poj 2352 && hdu 1541 Stars (树状数组)

DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are

2016-08-22 20:31:34 210

原创 HDU 1556 Color the ball(树状数组)

DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。Sample Input31 12 2

2016-08-22 20:21:49 130

原创 POJ 2182 Lost Cows树状数组

DescriptionN (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering hole' and drank a few too many beers be

2016-08-22 17:27:04 202

原创 POJ3321:Apple Tree(树状数组)

DescriptionThere is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.

2016-08-22 15:41:13 417

原创 概率dp UVA 11762 Race to 1

这题就是寻找各种可能到达1的路径,然后求期望值,我们可以把它分解来看,因为路径长度为它走过的所有的点所需路径加上如果到达某一点可以继续走下去的话所增加的路径,然后期望就是总的路径除以所有有可能往下走的点(如果到达1,那么可能的点就是0,除以0是不行的,所以就直接返回0),由从某一点出发到下一点可能的路径值,逐步递推到1,再返回就可以得到结果。#include #include bool

2016-08-19 13:04:31 183

原创 POJ - 1222 EXTENDED LIGHTS OUT高斯消元

DescriptionIn an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons each (the actual puzzle has 5 rows of 5 buttons each). Each button has a light. When a button is pres

2016-08-19 10:52:07 173

原创 UVA 108 Maximum Sum 最大连续子矩阵和

DescriptionBackgroundA problem that is simple to solve in one dimension is often much more difficult to solve in more than one dimension. Consider satisfying a boolean expression in conjun

2016-08-17 17:29:38 165

原创 Fibonacci

DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21,

2016-08-17 15:55:49 194

原创 矩阵乘法 Matrix Power Series

DescriptionGiven a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak.InputThe input contains exactly one test case. The first line of input contain

2016-08-17 15:51:33 171

原创 Dave

DescriptionRecently, Dave is boring, so he often walks around. He finds that some places are too crowded, for example, the ground. He couldn't help to think of the disasters happening recently. Cr

2016-08-17 11:02:39 362

原创 二分法 The Frog's Games

DescriptionThe annual Games in frogs' kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athletes

2016-08-16 16:30:02 681

原创 优先队列 The kth great number

DescriptionXiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number writte

2016-08-16 15:43:40 209

原创 Lweb and String

Problem DescriptionLweb has a string S.Oneday, he decided to transform this string to a new sequence. You need help him determine this transformation to get a sequence which has the longes

2016-08-16 14:26:27 363

原创 A water problem

Problem DescriptionTwo planets named Haha and Xixi in the universe and they were created with the universe beginning.There is 73 days in Xixi a year and 137 days in Haha a year. Now yo

2016-08-16 14:21:59 224

原创 Zhu and 772002

Problem DescriptionZhu and 772002 are both good at math. One day, Zhu wants to test the ability of 772002, so he asks 772002 to solve a math problem. But 772002 has a appointment with his girl

2016-08-16 14:16:36 564

原创 HDU 5038 Grade

DescriptionTed is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom

2016-08-13 17:36:27 176

原创 HDU4277 USACO ORZ

DescriptionLike everyone, cows enjoy variety. Their current fancy is new shapes for pastures. The old rectangular shapes are out of favor; new geometries are the favorite. I. M. Hei, the lead co

2016-08-13 15:46:22 279

原创 HDU 4282 A very hard mathematic problem

Description  Haoren is very good at solving mathematic problems. Today he is working a problem like this:   Find three positive integers X, Y and Z (X 1) that holds    X^Z + Y^Z + XYZ = K

2016-08-13 12:20:15 822

原创 HDU5477 A Sweet Journey

DescriptionMaster Di plans to take his girlfriend for a travel by bike. Their journey, which can be seen as a line segment of length L, is a road of swamps and flats. In the swamp, it takes A poin

2016-08-13 10:41:52 229

原创 HDU4278 Faulty Odometer

Description  You are given a car odometer(里程表) which displays the miles traveled as an integer(整数). The odometer has a defect(缺点), however: it proceeds(收入) from the digit(数字) 2 to the digit 4

2016-08-13 10:13:51 250

原创 概率dp HDU4336 Card Collector

DescriptionIn your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you collect all the 108 people in the famous novel Water Margin, you wi

2016-08-11 19:46:04 191

原创 数位dp HDU 3555 Bomb

DescriptionThe counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current numb

2016-08-11 17:10:49 161

原创 状态dp POJ 3254 Corn Fields

DescriptionFarmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squar

2016-08-11 14:40:58 155

原创 概率dp LightOJ 1030 Discovering Gold

DescriptionYou are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.Initially you are in position 1. Now each turn you th

2016-08-10 20:45:08 196

原创 kmp Seek the Name, Seek the Fame

DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the sa

2016-08-09 14:30:44 147

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除