算法
zacharytse
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
最长上升子序列(LIS)的一点理解
问题描述给定n个整数A1,A2,…,An,按从左到右的顺序选出尽量多的整数,组成一个上升子序列。比如从序列1,6,2,3,7,5中,可以选出上升子序列1,2,3,5,也可以选出1,6,7,但前者更长。选出的上升子序列中相邻元素不能相等。问题分析设d(i)为以编号i结尾的上升子序列的长度。那么对于上述序列1,6,2,3,7,5来说: d(1)=1 d(2)=2 d(3)=2(因为2<6,所以子序原创 2017-02-05 10:25:20 · 420 阅读 · 0 评论 -
1004. Counting Leaves (30)
1004. Counting Leaves (30) A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file con...原创 2018-04-07 11:05:17 · 102 阅读 · 0 评论 -
1013. Battle Over Cities (25)
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we nee...原创 2018-04-18 17:49:36 · 138 阅读 · 0 评论 -
1012. The Best Rank (25)
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - Eng...原创 2018-04-18 16:44:33 · 145 阅读 · 0 评论 -
1011. World Cup Betting (20)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Si...原创 2018-04-18 16:43:10 · 125 阅读 · 0 评论 -
1010. Radix (25)
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive in...原创 2018-04-11 21:58:40 · 169 阅读 · 0 评论 -
1009. Product of Polynomials (25)
This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...原创 2018-04-10 16:19:27 · 111 阅读 · 0 评论 -
1008. Elevator (20)
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec...原创 2018-04-08 22:41:21 · 248 阅读 · 0 评论 -
1007. Maximum Subsequence Sum (25)
Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequence w...原创 2018-04-08 22:16:47 · 120 阅读 · 0 评论 -
1006. Sign In and Sign Out (25)
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in’s and out’s, you...原创 2018-04-07 18:29:27 · 153 阅读 · 0 评论 -
Evaluate Division(LeetCode 339)
题目 Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answe原创 2017-12-05 19:30:51 · 199 阅读 · 0 评论 -
Course Schedule(leetcode 207)
题目There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pai原创 2017-12-08 18:07:21 · 190 阅读 · 0 评论 -
放置街灯(UVA 10859)
##问题描述 给你一个n个点m条边的无向无环图,在尽量少的节点上放灯,使得所有灯都被照亮。每盏灯将照亮以它为一个端点的所有边。在灯的总数最小的前提下,被两盏灯同时照亮的边数应尽量大。##输入格式 输入的第一行为测试数据组数T(T≤30)。每组数据第一行为两个整数n和m(m<n≤1000),即点数(所有点编号为0~n-1)和边数;以下m行每行为原创 2017-02-08 10:59:21 · 576 阅读 · 0 评论 -
黑客的攻击(UVA 11825)
题目假设你是一个黑客,侵入了一个有着n台计算机(编号为0,1…,n-1)的网络。一共有n种服务,每台计算机都运行着所有服务。对于每台计算机,你都可以选择一项服务,终止这台计算机和所有与它相邻计算机的该项服务(如果其中一些服务已经停止,则这些服务继续处于停止状态)。你的目标是让尽量多的服务完全瘫痪(即:没有任何计算机运行该项服务)。输入格式输入包含多组数据,每组数据的第一行为整数n(1≤n≤16);以原创 2017-02-07 10:55:42 · 533 阅读 · 0 评论 -
1005. Spell It Right (20)
1005. Spell It Right (20)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file ...原创 2018-04-07 13:33:42 · 129 阅读 · 0 评论
分享