- 博客(27)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode 121: Best Time to Buy and Sell Stock
题目链接:https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/描述Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to com
2017-10-31 21:26:56 188
原创 LeetCode 120: Triangle
题目链接:https://leetcode.com/problems/triangle/description/描述Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given
2017-10-31 20:28:49 194
原创 LeetCode 136:Single Number
题目链接:https://leetcode.com/problems/single-number/description/描述Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear ru
2017-10-31 08:24:03 541
原创 LeetCode 32:Longest Valid Parentheses
题目链接:https://leetcode.com/problems/longest-valid-parentheses/description/描述Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses subs
2017-10-28 14:02:33 185
原创 Leetcode 60: Permutation Sequence
题目链接:https://leetcode.com/problems/permutation-sequence/description/描述The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order, We get th
2017-10-27 16:31:56 199
原创 LeetCode 67: Add Binary
题目链接:https://leetcode.com/problems/add-binary/description/描述Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.输入输入两个字符串,a和b,求二进制和并以字符串形式返回。
2017-10-27 07:59:40 143
原创 LeetCode 69: Sqrt(x)
题目链接:https://leetcode.com/problems/sqrtx/description/描述Implement int sqrt(int x).Compute and return the square root of x.输入输入一个自然数输出输出该自然数的平方根(最接近的)样例输入16 18样例输出4 4算法思想:这道题使用到了本科学过的数值分析,可以使用牛顿迭代法,非常经
2017-10-26 20:40:18 206
原创 题目84:阶乘的0
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=84描述计算n!的十进制表示最后有多少个0输入第一行输入一个整数N表示测试数据的组数(1<=N<=100) 每组测试数据占一行,都只有一个整数M(0<=M<=10000000)输出输出M的阶乘的十进制表示中最后0的个数 比如5!=120则最后的0的个数为1样例输入6 3 60 100
2017-10-24 18:41:43 518
原创 题目33:蛇形填数
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=33描述在n*n方陈里填入1,2,…,n*n,要求填成蛇形。例如n=4时方陈为: 10 11 12 1 9 16 13 2 8 15 14 3 7 6 5 4输入直接输入方陈的维数,即n的值。(n<=100)输出输出结果是蛇形方陈。样例输入3样例输出7 8 1 6 9 2 5 4
2017-10-23 18:35:29 252
原创 题目5:Binary String Matching
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=5描述Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B?
2017-10-20 21:01:21 338
原创 题目88:汉诺塔(一)
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=88描述在印度,有这么一个古老的传说:在世界中心贝拿勒斯(在印度北部)的圣庙里,一块黄铜板上插着三根宝石针。印度教的主神梵天在创造世界的时候,在其中一根针上从下到上地穿好了由大到小的64片金片,这就是所谓的汉诺塔。不论白天黑夜,总有一个僧侣在按照下面的法则移动这些金片:一次只移动一片,不管在哪
2017-10-20 20:27:49 388
原创 题目51:管闲事的小明
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=51描述某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。 由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。
2017-10-20 16:01:33 244
原创 题目45:棋盘覆盖
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=45描述在一个2^k × 2^k(1<=k<=100)的棋盘中恰有一方格被覆盖,如图1(k=2时),现用一缺角的2×2方格(图2为其中缺右下角的一个),去覆盖2k×2k未被覆盖过的方格,求需要类似图2方格总的个数s。如k=1时,s=1;k=2时,s=5 输入第一行m表示有m组测试数据; 每
2017-10-18 18:51:24 523
原创 Leetcode 79:Word Search
题目链接:https://leetcode.com/problems/word-search/description/描述Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, whe
2017-10-18 11:08:30 179
原创 题目927:The partial sum problem
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=927描述One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the
2017-10-14 20:20:16 186
原创 题目1058:部分和问题
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=1058描述给定整数a1、a2、…….an,判断是否可以从中选出若干数,使它们的和恰好为K。输入首先,n和k,n表示数的个数,k表示数的和。 接着一行n个数。 (1<=n<=20,保证不超int范围)输出如果和恰好可以为k,输出“YES”,并按输入顺序依次输出是由哪几个数的和组成,否则“N
2017-10-14 19:58:19 285
原创 题目738:Calendar Game
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=738描述Adam and Eve enter this year’s ACM International Collegiate Programming Contest. Last night, they played the Calendar Game, in celebration of
2017-10-14 17:08:25 223
原创 题目635:Oh, my goddess
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=635描述Shining Knight is the embodiment of justice and he has a very sharp sword can even cleavewall. Many bad guys are dead on his sword.One day, tw
2017-10-13 16:05:03 245
原创 题目36:数的长度
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?cid=330&cpid=36描述N!阶乘是一个非常大的数,大家都知道计算公式是N!=N*(N-1)······*2*1.现在你的任务是计算出N!的位数有多少(十进制)?输入首行输入n,表示有多少组测试数据(n<10) 随后n行每行输入一组测试数据 N( 0 < N < 1000000 )输出对于每
2017-10-12 19:20:51 236
原创 C++(C)数字四舍五入函数
/* round vs floor vs ceil vs trunc */#include <stdio.h> /* printf */#include <math.h> /* round, floor, ceil, trunc */int main (){ const char * format = "%.1f \t%.1f \t%.1f \t%.1f \t%.1f
2017-10-12 14:27:42 3644
原创 题目483:Nightmare
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=483描述Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get o
2017-10-10 11:03:42 220
原创 题目43:24 Point game
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=43描述There is a game which is called 24 Point game. In this game , you will be given some numbers. Your task is to find an expression which have al
2017-10-09 13:53:42 250
原创 题目523:亡命逃窜
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=523描述从前有个叫hck的骑士,为了救我们美丽的公主,潜入魔王的老巢,够英雄吧。不过英雄不是这么好当的。这个可怜的娃被魔王抓住了,倍受折磨,生死一线。有一天魔王出去约会了,这可是一个千载难逢的逃命机会。你现在的任务就是判断一下这个英雄未遂的孩子能不能在魔王回来之前逃出魔王的城堡,成功逃生,最
2017-10-09 11:30:21 248
原创 题目284:坦克大战
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=284描述Many of us had played the game “Battle city” in our childhood, and some people (like me) even often play it on computer now. What we are dis
2017-10-04 22:48:00 512
原创 题目353:3D dungeon
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=353描述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 wi
2017-10-03 20:37:01 231
原创 题目491:幸运三角形
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=491描述话说有这么一个图形,只有两种符号组成(‘+’或者‘-’),图形的最上层有n个符号,往下个数依次减一,形成倒置的金字塔形状,除第一层外(第一层为所有可能情况),每层形状都由上层决定,相邻的符号相同,则下层的符号为‘+’,反之,为‘-’;如下图所示(n = 3 时的两种情况): 如
2017-10-03 11:30:09 286
原创 题目488:素数环
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=488描述有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。 输入有多组测试数据,每组输入一个n(0<n<20),n=0表示输入结束。输出每组第一行输出对应的Case
2017-10-02 21:50:28 425
本科计算机网络课件
2018-05-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人