04 2021 档案
摘要:给你一个整数数组 nums ,除某个元素仅出现 一次 外,其余每个元素都恰出现 三次 。请你找出并返回那个只出现了一次的元素。 示例 1: 输入:nums = [2,2,3,2] 输出:3 示例 2: 输入:nums = [0,1,0,1,0,1,99] 输出:99 提示: 1 ⇐ nums.len
阅读全文
摘要:You are given two integer arrays a and b of length n. You can reverse at most one subarray (continuous subsegment) of the array 𝑎a. Your task is to r
阅读全文
摘要:Polycarp is an organizer of a Berland ICPC regional event. There are 𝑛n universities in Berland numbered from 1 to n. Polycarp knows all competitive
阅读全文
摘要:There is a n×m grid. You are standing at cell (1,1) and your goal is to finish at cell (n,m). You can move to the neighboring cells to the right or do
阅读全文
摘要:You have r red and b blue beans. You'd like to distribute them among several (maybe, one) packets in such a way that each packet: has at least one red
阅读全文
摘要:Baby Ehab was toying around with arrays. He has an array a of length n. He defines an array to be good if there's no way to partition it into 2 subseq
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/9925/C 来源:牛客网 Given two non-negative integers XX and YY, determine the value of \(\Sigma_{i = 0}^X\Sigma_{j = [
阅读全文
摘要:有可能是一个本应该有返回值的函数没有写return语句造成的,本地能过OJ上就会报段错误。
阅读全文
摘要:一只青蛙想要过河。 假定河流被等分为若干个单元格,并且在每一个单元格内都有可能放有一块石子(也有可能没有)。 青蛙可以跳上石子,但是不可以跳入水中。 给你石子的位置列表 stones(用单元格序号 升序 表示), 请判定青蛙能否成功过河(即能否在最后一步跳至最后一块石子上)。 开始时, 青蛙默认已站
阅读全文
摘要:题目描述 给定两个正整数 a 和 b,求在 [a,b]中的所有整数中,每个数码(digit)各出现了多少次。 输入格式 仅包含一行两个整数 a,b,含义如上所述。 输出格式 包含一行十个整数,分别表示 0∼9 在 [a,b]中出现了多少次。 输入输出样例 输入 #1复制 1 99 输出 #1复制 9
阅读全文
摘要:Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。
阅读全文
摘要:题目背景 windy 定义了一种 windy 数。 题目描述 不含前导零且相邻两个数字之差至少为 22 的正整数被称为 windy 数。windy 想知道,在 aa和 bb 之间,包括 aa 和 bb ,总共有多少个 windy 数? 输入格式 输入只有一行两个整数,分别表示 aa 和 bb。 输出
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/15329/F 来源:牛客网 题目描述 There’s a new art installation in town, and it inspires you... to play a childish game. The
阅读全文
摘要:题目描述 对一个由(,),[,]括号组成的字符串,求出其中最长的括号匹配子串。具体来说,满足如下条件的字符串成为括号匹配的字符串: 1.(),[]是括号匹配的字符串。 2.若A是括号匹配的串,则(A),[A]是括号匹配的字符串。 3.若A,B是括号匹配的字符串,则AB也是括号匹配的字符串。 例如:(
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11171/B 来源:牛客网 小 Q 的院子里种了 n朵彼岸花,其中第 i 朵的彼岸花的美丽值为 ai,彼岸花按照编号从小到大从左向右排成了一排。 现在小 Q 有 m 个问题,他每次会给出一个区间 [l,r][l,r],他
阅读全文
摘要:Avin is studying series. A series is called "wave" if the following conditions are satisfied: It contains at least two elements; All elements at odd p
阅读全文
摘要:Avin has two trees which are not connected. He asks you to add an edge between them to make them connected while minimizing the function \(\Sigma_{i =
阅读全文
摘要:题目描述 在数轴上有 n个闭区间从 1 至 n 编号,第 i 个闭区间为 [li,ri][l**i,r**i] 。 现在要从中选出 m 个区间,使得这 m 个区间共同包含至少一个位置。换句话说,就是使得存在一个 x ,使得对于每一个被选中的区间 [li,ri][l**i,r**i],都有 li≤x≤
阅读全文
摘要:题目描述 在MarsMar**s星球上,每个MarsMar**s人都随身佩带着一串能量项链。在项链上有NN颗能量珠。能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数。并且,对于相邻的两颗珠子,前一颗珠子的尾标记一定等于后一颗珠子的头标记。因为只有这样,通过吸盘(吸盘是MarsMar**s
阅读全文
摘要:You are given three integers a, 𝑏b and c. Find two positive integers x and y (x>0, y>0) such that: the decimal representation of x without leading ze
阅读全文
摘要:You have a card deck of n cards, numbered from top to bottom, i. e. the top card has index 1and bottom card — index n. Each card has its color: the 𝑖
阅读全文
摘要:Let's define the cost of a string 𝑠s as the number of index pairs i and j (1≤i<j<|s|) such that si=sj and si+1=sj+1. You are given two positive integ
阅读全文
摘要:827. 最大人工岛 难度困难83 在二维地图上, 0代表海洋, 1代表陆地,我们最多只能将一格 0 海洋变成 1变成陆地。 进行填海之后,地图上最大的岛屿面积是多少?(上、下、左、右四个方向相连的 1 可形成岛屿) 示例 1: 输入: [[1, 0], [0, 1]] 输出: 3 解释: 将一格0
阅读全文
摘要:Codeforces Round #712 (Div. 2) A. Déjà Vu 暴力瞎搞即可,只有全a是不满足的,否则挑选a更多的一端加上a,当然也可以分别加a进行判断。 #include <bits/stdc++.h> using namespace std; int main() { int
阅读全文
摘要:macOS下使用bits/stdc++.h万能头文件 1. 终端中输入 echo | g++ -v -x c++ -E - #include <...> search starts here: /usr/local/include /Library/Developer/CommandLineTool
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/12548/J 来源:牛客网 题目描述 As a master of parallel computing, schwer is recently considering about the method to achie
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/12548/I 来源:牛客网 题目描述 Mr. Main took a train from city ss to city tt and passed a plain full of windmills. The tra
阅读全文