02 2019 档案
摘要:https://ac.nowcoder.com/acm/contest/372#question A.救救猫咪 #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N; struct Node {
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2087 Problem Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805491530579968 Suppose a bank has K windows open for service. There is a yellow line in
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805439202443264 Shopping in Mars is quite a different experience. The Mars people pay by
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805347921805312 Given a syntax tree (binary), you are supposed to output the correspondi
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805346063728640 There is a kind of balanced binary search tree named red-black tree in t
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805346428633088 A vertex cover of a graph is a set of vertices such that each edge of th
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805437411475456 Eva is trying to make her own color stripe out of a given one. She would
阅读全文
摘要:#include <iostream> #include <stdlib.h> #include <time.h> #include <stdio.h> using namespace std; class ErLingSiBa { private: int Map[4][4], tmp[4][4]
阅读全文
摘要:https://leetcode.com/problems/squares-of-a-sorted-array/ Given an array of integers A sorted in non-decreasing order, return an array of the squares o
阅读全文
摘要:https://leetcode.com/problems/add-digits/ Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example
阅读全文
摘要:https://leetcode.com/problems/number-of-segments-in-a-string/ Count the number of segments in a string, where a segment is defined to be a contiguous
阅读全文
摘要:https://leetcode.com/problems/unique-morse-code-words/ International Morse Code defines a standard encoding where each letter is mapped to a series of
阅读全文
摘要:https://leetcode.com/problems/to-lower-case/ Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercas
阅读全文
摘要:https://leetcode.com/problems/rotated-digits/ X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that
阅读全文
摘要:https://leetcode.com/problems/detect-capital/ Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage
阅读全文
摘要:https://leetcode.com/problems/ransom-note/ Given an arbitrary ransom note string and another string containing letters from all the magazines, write a
阅读全文
摘要:https://leetcode.com/problems/reverse-linked-list-ii/ Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list.
阅读全文
摘要:https://leetcode.com/problems/reorder-list/ Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify th
阅读全文
摘要:https://leetcode.com/problems/k-diff-pairs-in-an-array/ Given an array of integers and an integer k, you need to find the number of unique k-diff pair
阅读全文
摘要:https://leetcode.com/problems/partition-list/ Given a linked list and a value x, partition it such that all nodes less than x come before nodes greate
阅读全文
摘要:https://vjudge.net/problem/HRBUST-1955 9 * 9 的 Sudoku 给每个格子标号 num 并且通过标号唯一确定格子的位置在 num / 9 行 num % 9 列 判断待定数字是不是在每行每列每宫中没有出现过 如果可以顺利搜索完所有格子 ans 标为 1 如
阅读全文
摘要:https://leetcode.com/problems/reverse-only-letters/ Given a string S, return the "reversed" string where all characters that are not a letter stay in
阅读全文
摘要:https://leetcode.com/problems/robot-return-to-origin/ There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805359372255232 Given a tree, you are supposed to tell if it is a complete binary tree.
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805388447170560 A supply chain is a network of retailers(零售商), distributors(经销商), and su
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805355987451904 A Binary Search Tree (BST) is recursively defined as a binary tree which
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805372601090048 A family hierarchy is usually presented by a pedigree tree where all the
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805379664297984 Indeed there are many different tourist routes from our city to Rome. Yo
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805376476626944 A supply chain is a network of retailers(零售商), distributors(经销商), and su
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805370650738688 Among all the factors of a positive integer N, there may exist several c
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805343236767744 The task of this problem is simple: insert a sequence of distinct positi
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805389634158592 The task of this problem is simple: insert a sequence of distinct positi
阅读全文
摘要:https://leetcode.com/problems/reverse-string-ii/ Given a string and an integer k, you need to reverse the first k characters for every 2k characters c
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805464397627392 A traveler's map gives the distances between cities along the highways,
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805466364755968 Given an increasing sequence S of N integers, the median is the number a
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805480801550336 A Digital Library contains millions of books, stored according to their
阅读全文
摘要:https://leetcode.com/problems/rectangle-area/ Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by it
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805380754817024 An inorder binary tree traversal can be implemented in a non-recursive w
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805381845336064 Given a sequence of positive integers and another positive integer p. Th
阅读全文
摘要:https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/ Given a singly linked list where elements are sorted in ascending order, conv
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805402305150976 Eva loves to collect coins from all over the universe, including some ot
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805404939173888 An AVL tree is a self-balancing binary search tree. In an AVL tree, the
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1166 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是
阅读全文
摘要:https://leetcode.com/problems/longest-uncommon-subsequence-i/ Given a group of two strings, you need to find the longest uncommon subsequence of this
阅读全文
摘要:https://leetcode.com/problems/insertion-sort-list/ Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805417945710592 Stack is one of the most fundamental data structures, which is based on
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805354762715136 British astronomer Eddington liked to ride a bike. It is said that in or
阅读全文
摘要:https://leetcode.com/problems/rotate-list/ Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Example
阅读全文
摘要:https://leetcode.com/problems/split-linked-list-in-parts/ Given a (singly) linked list with head node root, write a function to split the linked list
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805362341822464 A supply chain is a network of retailers(零售商), distributors(经销商), and su
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805363117768704 This time your job is to fill a sequence of N positive integers into a s
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805427332562944 Given a stack which can keep M numbers at most. Push N numbers in the or
阅读全文
摘要:https://leetcode.com/problems/find-k-pairs-with-smallest-sums/ You are given two integer arrays nums1 and nums2 sorted in ascending order and an integ
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805482919673856 A graph which is connected and acyclic can be considered a tree. The hig
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805521431773184 A family hierarchy is usually presented by a pedigree tree. Your job is
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805349851185152 In graph theory, an Eulerian path is a path in a graph which visits ever
阅读全文
摘要:import java.util.*; import java.math.*; public class Main{ public static void main(String args[]){ Scanner cin = new Scanner(System.in); BigInteger a, b; //以文件EOF结束 ...
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 Given a pair of positive integers, for example, 6 and 110, can this equa
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805345401028608 For a student taking the online course "Data Structures" on China Univer
阅读全文
摘要:https://pintia.cn/problem-sets/994805342720868352/problems/994805407749357568 A Binary Search Tree (BST) is recursively defined as a binary tree which
阅读全文