Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the package is…
Emily the entrepreneur has a cool business idea: packaging and selling snowakes. She has devised amachine that captures snowakes as they fall, and serializes them into a stream of snowakes that ow,one by one, into a package. Once the package is full,…
用set,保存当前区间出现过的数字,如果下一个数字没有出现过,加入,否则删掉左端点,直到没有重复为止 #include<bits/stdc++.h> using namespace std; ; int A[maxn]; int main() { int T; scanf("%d",&T); while(T--){ int n; scanf("%d",&n); ; i < n; i++) scanf("%d",A…
题目: Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the pa…
Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captures snowflakes as they fall, and serializes them into a stream of snowflakes that flow, one by one, into a package. Once the packag…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 类似尺取法. 用set判断这段区间有没有重复的数字. 有的话,就把头节点的那个数字删掉,直到没有为止. [代码] /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you promise that the solution is right? At least,the main ide…
题目链接:https://leetcode.com/problems/trapping-rain-water/description/ 题目大意:与84题做比较,在直方图中计算其蓄水能力.例子如下: 法一(借鉴):暴力,还是很难想到的,需要推理数学功底.因为这里暴力的前提条件是:计算每个点的蓄水能力,相当于求解,min(每个点左边的最大高度,每个点右边的最大高度)-当前值.也就是这里,把一整个蓄水池的分解成一个点一个点的蓄水能力.代码如下(耗时150ms): public int trap(in…
传送门 1293 - Document Analyzer PDF (English) Statistics Forum Time Limit: 3 second(s) Memory Limit: 32 MB You work in a leading software development company. As you are great in coding, most of the critical tasks are allotted for you. You like the ch…
Description Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day…