04 2019 档案

摘要:#include using namespace std; const int maxn = 3010; string s; int dp[maxn][maxn]; int main() { cin >> s; int len = s.length(); memset(dp, 0, sizeof(dp)); for(int i = len - 1; i >=... 阅读全文
posted @ 2019-04-29 16:36 _Zlrrr 阅读(302) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3068 Problem Description 给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等 Input 输入有多组c 阅读全文
posted @ 2019-04-29 15:34 _Zlrrr 阅读(121) 评论(0) 推荐(0)
摘要:A. Reachable Numbers 代码: #include <bits/stdc++.h> using namespace std; const int maxn = 1e9 + 7; int N; set<int> s; int main() { scanf("%d", &N); whil 阅读全文
posted @ 2019-04-28 20:05 _Zlrrr 阅读(197) 评论(0) 推荐(0)
摘要:A.2016 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 2016 的倍数。 Input 输入包含不超过 30 组数据。 每组数据包含两个整数 n,m (1≤n,m≤10 9). Output对于每组数据,输出一个整数表 阅读全文
posted @ 2019-04-26 20:39 _Zlrrr 阅读(274) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3486 Problem Description YaoYao has a company and he wants to employ m people recently. Since his company is 阅读全文
posted @ 2019-04-25 11:01 _Zlrrr 阅读(197) 评论(0) 推荐(0)
摘要:A. Neko Finds Grapes 代码: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N, M; int a[maxn], b[maxn]; int odda = 0, evea = 阅读全文
posted @ 2019-04-25 10:52 _Zlrrr 阅读(211) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1050 Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-arra 阅读全文
posted @ 2019-04-24 19:27 _Zlrrr 阅读(230) 评论(0) 推荐(0)
摘要:解决区间查询最大值最小值的问题 用 $O(N * logN)$ 的复杂度预处理 查询的时候只要 $O(1)$ 的时间 这个算法是 real 小清新了 有一个长度为 N 的数组进行 M 次查询 可以查询区间最大值和最小值 阅读全文
posted @ 2019-04-24 16:03 _Zlrrr 阅读(240) 评论(0) 推荐(0)
摘要:A. Reverse a Substring 代码: #include <bits/stdc++.h> using namespace std; int N; string s; int main() { scanf("%d", &N); cin >> s; int temp = -1; for(i 阅读全文
posted @ 2019-04-24 14:06 _Zlrrr 阅读(208) 评论(0) 推荐(0)
摘要:A - Taxi Fare Last September, Hangzhou raised the taxi fares. The original flag-down fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after 阅读全文
posted @ 2019-04-23 18:15 _Zlrrr 阅读(254) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/largest-rectangle-in-histogram/ Given n non-negative integers representing the histogram's bar height where the width of 阅读全文
posted @ 2019-04-22 20:43 _Zlrrr 阅读(118) 评论(0) 推荐(0)
摘要:A. Middle of the Contest 代码: #include <bits/stdc++.h> using namespace std; int h1, m1, h2, m2; int tim1 = 0, tim2 = 0; int main() { scanf("%d:%d", &h1 阅读全文
posted @ 2019-04-22 15:03 _Zlrrr 阅读(111) 评论(0) 推荐(0)
摘要:A. Sushi for Two 代码: #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N, cnt = 0; int a[maxn], vis[maxn]; int main() { sca 阅读全文
posted @ 2019-04-21 21:37 _Zlrrr 阅读(126) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2222 Problem Description In the modern time, Search engine came into the life of everybody like Google, Baid 阅读全文
posted @ 2019-04-21 12:56 _Zlrrr 阅读(165) 评论(0) 推荐(0)
摘要:see u again 阅读全文
posted @ 2019-04-21 09:43 _Zlrrr 阅读(186) 评论(0) 推荐(0)
摘要:A. Maxim and Biology 代码: #include <bits/stdc++.h> using namespace std; int N; string s; int minn = 0x3f3f3f3f; int main() { scanf("%d", &N); cin >> s; 阅读全文
posted @ 2019-04-19 18:27 _Zlrrr 阅读(238) 评论(0) 推荐(0)
摘要:A. Restoring Three Numbers 代码: #include <bits/stdc++.h> using namespace std; int n[5]; int a, b, c; int main() { for(int i = 0; i < 4; i ++) scanf("%d 阅读全文
posted @ 2019-04-17 15:58 _Zlrrr 阅读(242) 评论(0) 推荐(0)
摘要:A. The Doors 代码: #include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int N; int Zero = 0, One = 0; int a[maxn], b[maxn], suma[max 阅读全文
posted @ 2019-04-16 20:47 _Zlrrr 阅读(213) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/find-the-town-judge/ In a town, there are N people labelled from 1 to N. There is a rumor that one of these people is se 阅读全文
posted @ 2019-04-16 11:39 _Zlrrr 阅读(247) 评论(0) 推荐(0)
摘要:A. Detective Book 代码: #include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 10; int N; int a[maxn]; int maxx = 0; int main() { scanf("% 阅读全文
posted @ 2019-04-15 22:40 _Zlrrr 阅读(168) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/longest-word-in-dictionary-through-deleting/ Given a string and a string dictionary, find the longest string in the dict 阅读全文
posted @ 2019-04-15 21:14 _Zlrrr 阅读(132) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/h-index/ Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to comp 阅读全文
posted @ 2019-04-15 16:36 _Zlrrr 阅读(126) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sum-of-even-numbers-after-queries/ We have an array A of integers, and an array queries of queries. For the i-th query v 阅读全文
posted @ 2019-04-15 15:52 _Zlrrr 阅读(135) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/product-of-array-except-self/ Given an array nums of n integers where n > 1, return an array output such that output[i]  阅读全文
posted @ 2019-04-15 01:00 _Zlrrr 阅读(107) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/search-in-rotated-sorted-array-ii/ Suppose an array sorted in ascending order is rotated at some pivot unknown to you be 阅读全文
posted @ 2019-04-15 00:40 _Zlrrr 阅读(126) 评论(0) 推荐(0)
摘要:A. Game 23 #include <bits/stdc++.h> using namespace std; int N, M; int main() { int ans = 0; int cnt = 0; scanf("%d%d", &N, &M); if(N == M) ans = 0; e 阅读全文
posted @ 2019-04-14 23:55 _Zlrrr 阅读(146) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n/ Given a binary string S (a string consisting only of '0' and '1's) an 阅读全文
posted @ 2019-04-13 09:37 _Zlrrr 阅读(420) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/number-of-digit-one/ Given an integer n, count the total number of digit 1 appearing in all non-negative integers less t 阅读全文
posted @ 2019-04-13 09:16 _Zlrrr 阅读(128) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sum-of-square-numbers/ Given a non-negative integer c, your task is to decide whether there're two integers a and b such 阅读全文
posted @ 2019-04-13 09:05 _Zlrrr 阅读(139) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/complement-of-base-10-integer/ Every non-negative integer N has a binary representation. For example, 5 can be represent 阅读全文
posted @ 2019-04-13 08:57 _Zlrrr 阅读(284) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/di-string-match/ Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length. Return any perm 阅读全文
posted @ 2019-04-12 22:56 _Zlrrr 阅读(195) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/self-dividing-numbers/ A self-dividing number is a number that is divisible by every digit it contains. For example, 128 阅读全文
posted @ 2019-04-12 19:19 _Zlrrr 阅读(195) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/ugly-number/ Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose 阅读全文
posted @ 2019-04-12 19:03 _Zlrrr 阅读(149) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/integer-break/ Given a positive integer n, break it into the sum of at least two positive integers and maximize the prod 阅读全文
posted @ 2019-04-12 17:51 _Zlrrr 阅读(86) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/rectangle-overlap/ A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bott 阅读全文
posted @ 2019-04-12 17:05 _Zlrrr 阅读(125) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-04-12 16:39 _Zlrrr 阅读(120) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1144 A. Diverse Strings A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet a 阅读全文
posted @ 2019-04-12 11:46 _Zlrrr 阅读(196) 评论(0) 推荐(0)
摘要:A - Pokemon Master Calem and Serena are pokemon masters. One day they decided to have a pokemon battle practice before Pokemon World Championships. Ea 阅读全文
posted @ 2019-04-11 20:46 _Zlrrr 阅读(189) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/repeated-string-match/ Given two strings A and B, find the minimum number of times A has to be repeated such that B is a 阅读全文
posted @ 2019-04-11 20:37 _Zlrrr 阅读(117) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/repeated-substring-pattern/ Given a non-empty string check if it can be constructed by taking a substring of it and appe 阅读全文
posted @ 2019-04-11 20:22 _Zlrrr 阅读(191) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/add-to-array-form-of-integer/ For a non-negative integer X, the array-form of X is an array of its digits in left to rig 阅读全文
posted @ 2019-04-11 19:49 _Zlrrr 阅读(206) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/add-strings/ Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 阅读全文
posted @ 2019-04-11 19:36 _Zlrrr 阅读(116) 评论(0) 推荐(0)
摘要:Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following 3 operations permitt 阅读全文
posted @ 2019-04-11 19:28 _Zlrrr 阅读(126) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sort-array-by-parity/ Given an array A of non-negative integers, return an array consisting of all the even elements of  阅读全文
posted @ 2019-04-10 21:36 _Zlrrr 阅读(125) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/ Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elemen 阅读全文
posted @ 2019-04-10 21:32 _Zlrrr 阅读(118) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/valid-number/ Validate if a given string can be interpreted as a decimal number. Some examples:"0" => true" 0.1 " => tru 阅读全文
posted @ 2019-04-10 21:19 _Zlrrr 阅读(126) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/sudoku-solver/ Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all o 阅读全文
posted @ 2019-04-10 17:56 _Zlrrr 阅读(119) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/reverse-nodes-in-k-group/ Given a linked list, reverse the nodes of a linked list k at a time and return its modified li 阅读全文
posted @ 2019-04-10 17:28 _Zlrrr 阅读(122) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3264 Description For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farm 阅读全文
posted @ 2019-04-10 16:35 _Zlrrr 阅读(155) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3974 Problem Description There is a company that has N employees(numbered from 1 to N),every employee in the 阅读全文
posted @ 2019-04-10 12:01 _Zlrrr 阅读(211) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1136 A #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int N, K; struct Node { int L; int R; }n 阅读全文
posted @ 2019-04-10 08:46 _Zlrrr 阅读(198) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/longest-valid-parentheses/ Given a string containing just the characters '(' and ')', find the length of the longest val 阅读全文
posted @ 2019-04-09 21:21 _Zlrrr 阅读(164) 评论(0) 推荐(0)
摘要:int MaxSubSum3(int *arr, int len) { int i; long long MaxSum = 0; long long CurSum = 0; for(int i = 0; i MaxSum) MaxSum = CurSum; if(CurSum < 0) CurSum = 0; } return MaxSum; } 阅读全文
posted @ 2019-04-09 20:30 _Zlrrr 阅读(243) 评论(0) 推荐(0)
摘要:A - Cooking Competition "Miss Kobayashi's Dragon Maid" is a Japanese manga series written and illustrated by Coolkyoushinja. An anime television serie 阅读全文
posted @ 2019-04-09 20:09 _Zlrrr 阅读(270) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/group-anagrams/ Given an array of strings, group anagrams together. Example: Note: All inputs will be in lowercase. The 阅读全文
posted @ 2019-04-09 11:43 _Zlrrr 阅读(113) 评论(0) 推荐(0)
摘要:https://leetcode.com/problems/insert-interval/ Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary) 阅读全文
posted @ 2019-04-09 10:31 _Zlrrr 阅读(184) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2195 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit st 阅读全文
posted @ 2019-04-08 20:43 _Zlrrr 阅读(140) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2255 Problem Description 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每 阅读全文
posted @ 2019-04-08 14:39 _Zlrrr 阅读(111) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1083 Problem Description Consider a group of N students and P courses. Each student visits zero, one or more 阅读全文
posted @ 2019-04-08 13:19 _Zlrrr 阅读(134) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2063 Problem Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做pa 阅读全文
posted @ 2019-04-08 12:50 _Zlrrr 阅读(192) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3041 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 阅读全文
posted @ 2019-04-08 11:51 _Zlrrr 阅读(152) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/1139 A. Even Substrings You are given a string s=s1s2…sns=s1s2…sn of length nn, which only contains digits 11, 22, ...,  阅读全文
posted @ 2019-04-07 19:53 _Zlrrr 阅读(161) 评论(0) 推荐(0)
摘要:#include using namespace std; string add(string a, string b) { string c; int len1 = a.length(); int len2 = b.length(); int len = max(len1, len2); for(int i = len1; i = 0; i --) ... 阅读全文
posted @ 2019-04-07 10:51 _Zlrrr 阅读(526) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/554#question A #include <bits/stdc++.h> using namespace std; int N; long long dp[110][110]; int main() { scanf("%d 阅读全文
posted @ 2019-04-06 23:28 _Zlrrr 阅读(696) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1394 Problem Description The inversion number of a given number sequence a1, a2, ..., an is the number of pa 阅读全文
posted @ 2019-04-06 19:54 _Zlrrr 阅读(154) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3067 Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is t 阅读全文
posted @ 2019-04-06 10:46 _Zlrrr 阅读(207) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1556 Problem Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个 阅读全文
posted @ 2019-04-06 09:31 _Zlrrr 阅读(182) 评论(0) 推荐(0)