- 博客(24)
- 收藏
- 关注
原创 memset()函数源代码与fill()函数
一memset()函数: void *memset(void *s, int ch, size_t n); 作用:将s所指向的某一块内存中的每个字节的内容全部设置为ch指定的ASCII值, 块的大小由第三个参数指定,这个函数通常为新申请的内存做初始化工作。不知道有没有像我一样把memset当作万能的初始化工具,例如:int arr[n]; memset(arr,1...
2018-05-30 20:43:50 467
转载 memset()函数初始化问题
总来源:点击打开链接话说刚开始使用memset的时候一直以为memset是对每一个int赋值的,心里想有了memset还要for循环对数组进行初始化干嘛。但其实memset这个函数的作用是将数字以单个字节逐个拷贝的方式放到指定的内存中去 memset(dp,0,sizeof(dp)); int类型的变量一般占用4个字节,对每一个字节赋值0的话就变成了“00000000 00000000 000...
2018-05-29 21:45:16 4434 1
原创 搜索---广搜N - Find a way
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki. Yifenfei’s home is at the...
2018-05-29 20:41:33 296
原创 搜索--深搜--L - Oil Deposits
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides th...
2018-05-26 14:22:04 203
原创 搜索--广度搜索--J - Fire! (双bfs())
题目:Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s location in the...
2018-05-26 13:32:23 184
原创 搜索--I - Fire Game (两个节点)
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...
2018-05-23 21:33:58 324
原创 搜索--广搜深搜结合--H - Pots
You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i) empty the pot i ...
2018-05-22 21:30:19 267
原创 搜索--广度搜索--M - 非常可乐
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101...
2018-05-21 21:36:32 615
原创 搜索--广度--K - 迷宫问题
定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input一个5 × 5的二维数组,表示...
2018-05-19 15:44:20 145
原创 搜索---G - Shuffle'm Up
A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Ea...
2018-05-19 10:06:31 186
原创 搜索---广度搜索---F - Prime Path
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of sec...
2018-05-18 16:36:45 147
原创 搜索--广搜 E - Find The Multiple
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there...
2018-05-15 21:11:33 198
原创 搜索---广搜---C - Catch That Cow
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (...
2018-05-15 19:20:05 133
原创 搜索--B - Dungeon Master (三维空间)
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one uni...
2018-05-14 20:56:55 225
原创 动态规划--简单递推 POJ 2044
一只小蜜蜂...Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 90664 Accepted Submission(s): 32204Problem Description有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编...
2018-05-12 11:12:16 260
原创 动态规划--简单递推 poj 2084
母牛的故事Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 102018 Accepted Submission(s): 49927Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每...
2018-05-12 10:28:52 167
原创 动态规划--简单递推 poj 2084
数塔Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 54389 Accepted Submission(s): 31938Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所...
2018-05-12 10:17:24 216
原创 尼姆博弈 SG函数 1848 Fibonacci again and again
Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10498 Accepted Submission(s): 4495 Problem Des...
2018-05-02 21:14:14 167
原创 博弈 SG函数 1847 Good Luck in CET-4 Everybody!
Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12236 Accepted Submission(s): 7936 Problem...
2018-05-02 20:15:45 263 1
原创 poj 2975 Nim 尼姆博弈
NimTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 6495 Accepted: 3104 DescriptionNim is a 2-player game featuring several piles of stones. Players alternate turns, ...
2018-05-01 19:55:12 673
原创 poj 2234 Matches Game 尼姆博弈
Matches GameTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 11065 Accepted: 6466 DescriptionHere is a simple game. In this game, there are several piles of matches a...
2018-05-01 19:15:31 150
原创 尼姆博弈 1850 Being a Good Boy in Spring Festival
Being a Good Boy in Spring Festival Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8431 Accepted Submission(s): 5170 Pr...
2018-05-01 11:18:02 128
原创 博弈 威佐夫 2147 取(2堆)石子游戏
取(2堆)石子游戏 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3348 Accepted Submission(s): 2059 Problem Description有两堆石子,数...
2018-05-01 09:51:19 188
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人