CF550 DIV3
A - Diverse Strings CodeForces - 1144A
A string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: "fced", "xyz", "r" and "dabcef". The following string are notdiverse: "az", "aa", "bad" and "babc". Note that the letters 'a' and 'z' are not adjacent.
Formally, consider positions of all letters in the string in the alphabet. These positions should form contiguous segment, i.e. they should come one by one without any gaps. And all letters in the string should be distinct (duplicates are not allowed).
You are given a sequence of strings. For each string, if it is diverse, print "Yes". Otherwise, print "No".
Input
The first line contains integer nn (1≤n≤1001≤n≤100), denoting the number of strings to process. The following nn lines contains strings, one string per line. Each string contains only lowercase Latin letters, its length is between 11 and 100100, inclusive.
Output
Print nn lines, one line per a string in the input. The line should contain "Yes" if the corresponding string is diverse and "No" if the corresponding string is not diverse. You can print each letter in any case (upper or lower). For example, "YeS", "no" and "yES" are all acceptable.
Example
8
fced
xyz
r
dabcef
az
aa
bad
babc
Yes
Yes
Yes
Yes
No
No
No
No
题意:给你一个字符串,看这个字符串的字符排完序是否是连续的。
解法就题意我把这个字符串排个序,然后遍历看是否连续,是连续输出 YES 否则输出 NO。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=;
int n;
char s[maxn];
int a[maxn];
int main()
{
scanf("%d",&n);
while(n--)
{
scanf("%s",s);
int len=strlen(s);
for(int i=;i<len;i++)
{
a[i]=s[i]-'a';
}
sort(a,a+len);
bool flag=false;
// for(int i=0;i<len;i++)
// cout<<a[i]<<" ";
// cout<<endl;
for(int i=;i<len-;i++)
{
if(a[i]==a[i+]-)
continue;
else
{
flag=true;
break;
}
}
if(flag)
printf("No\n");
else
printf("Yes\n");
}
return ;
}
B - Parity Alternated Deletions CodeForces - 1144B
Polycarp has an array aa consisting of nn integers.
He wants to play a game with this array. The game consists of several moves. On the first move he chooses any element and deletes it (after the first move the array contains n−1n−1 elements). For each of the next moves he chooses any element with the only restriction: its parity should differ from the parity of the element deleted on the previous move. In other words, he alternates parities (even-odd-even-odd-... or odd-even-odd-even-...) of the removed elements. Polycarp stops if he can't make a move.
Formally:
- If it is the first move, he chooses any element and deletes it;
- If it is the second or any next move:If after some move Polycarp cannot make a move, the game ends.
- if the last deleted element was odd, Polycarp chooses any even element and deletes it;
- if the last deleted element was even, Polycarp chooses any odd element and deletes it.
Polycarp's goal is to minimize the sum of non-deleted elements of the array after end of the game. If Polycarp can delete the whole array, then the sum of non-deletedelements is zero.
Help Polycarp find this value.
Input
The first line of the input contains one integer nn (1≤n≤20001≤n≤2000) — the number of elements of aa.
The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (0≤ai≤1060≤ai≤106), where aiai is the ii-th element of aa.
Output
Print one integer — the minimum possible sum of non-deleted elements of the array after end of the game.
Examples
5
1 5 7 8 2
0
6
5 1 2 4 6 3
0
2
1000000 1000000
1000000
题意:给你一组数,按奇数偶数交错拿,直接最后不能拿了,要保证剩下的数值和最小。
思路:开两个优先队列,记录奇数和偶数的数量,因为是交错的拿,所以pop 奇数偶数两者最小值次,那么剩下的就是不能拿的了。
注意为什么要加一个
if(!q1.empty())
q1.pop();
if(!q0.empty())
q0.pop();
因为按着交错的拿的话,肯定有一个会被拿空,但是是交错的拿的话我可以选择先拿那个多的,比方说我有三个奇数,两个偶数,我按数量最少的偶数个数2 pop,但是注意我可以先拿奇数的,最后就可以多拿一个奇数所以要多一个奇数。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int maxn=;
int n;
int cnt1,cnt0;
int a[maxn];
int main()
{
scanf("%d",&n);
cnt0=cnt1=;
priority_queue<int>q1,q0;
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]%)
{
cnt1++;
q1.push(a[i]);
}
else
{
cnt0++;
q0.push(a[i]);
}
}
int cnt=min(cnt1,cnt0);
while(cnt--)
{
if(!q1.empty())
q1.pop();
if(!q0.empty())
q0.pop();
}
if(!q1.empty())
q1.pop();
if(!q0.empty())
q0.pop();
int ans=;
while(!q1.empty())
{
ans+=q1.top();
q1.pop();
}
while(!q0.empty())
{
ans+=q0.top();
q0.pop();
}
printf("%d\n",ans);
return ;
}
C - Two Shuffled Sequences CodeForces - 1144C
Two integer sequences existed initially — one of them was strictly increasing, and the other one — strictly decreasing.
Strictly increasing sequence is a sequence of integers [x1<x2<⋯<xk][x1<x2<⋯<xk]. And strictly decreasing sequence is a sequence of integers [y1>y2>⋯>yl][y1>y2>⋯>yl]. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.
They were merged into one sequence aa. After that sequence aa got shuffled. For example, some of the possible resulting sequences aa for an increasing sequence [1,3,4][1,3,4] and a decreasing sequence [10,4,2][10,4,2] are sequences [1,2,3,4,4,10][1,2,3,4,4,10] or [4,2,1,10,4,3][4,2,1,10,4,3].
This shuffled sequence aa is given in the input.
Your task is to find any two suitable initial sequences. One of them should be strictly increasing and the other one — strictly decreasing. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.
If there is a contradiction in the input and it is impossible to split the given sequence aa to increasing and decreasing sequences, print "NO".
Input
The first line of the input contains one integer nn (1≤n≤2⋅1051≤n≤2⋅105) — the number of elements in aa.
The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (0≤ai≤2⋅1050≤ai≤2⋅105), where aiai is the ii-th element of aa.
Output
If there is a contradiction in the input and it is impossible to split the given sequence aa to increasing and decreasing sequences, print "NO" in the first line.
Otherwise print "YES" in the first line and any two suitable sequences. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.
In the second line print nini — the number of elements in the strictly increasingsequence. nini can be zero, in this case the increasing sequence is empty.
In the third line print nini integers inc1,inc2,…,incniinc1,inc2,…,incni in the increasing order of its values (inc1<inc2<⋯<incniinc1<inc2<⋯<incni) — the strictly increasing sequence itself. You can keep this line empty if ni=0ni=0 (or just print the empty line).
In the fourth line print ndnd — the number of elements in the strictly decreasingsequence. ndnd can be zero, in this case the decreasing sequence is empty.
In the fifth line print ndnd integers dec1,dec2,…,decnddec1,dec2,…,decnd in the decreasing order of its values (dec1>dec2>⋯>decnddec1>dec2>⋯>decnd) — the strictly decreasing sequence itself. You can keep this line empty if nd=0nd=0 (or just print the empty line).
ni+ndni+nd should be equal to nn and the union of printed sequences should be a permutation of the given sequence (in case of "YES" answer).
Examples
7
7 2 7 3 3 1 4
YES
2
3 7
5
7 4 3 2 1
5
4 3 1 5 3
YES
1
3
4
5 4 3 1
5
1 1 2 1 2
NO
5
0 1 2 3 4
YES
0 5
4 3 2 1 0
题意:给你一个数组,看能不能分为两个数组,一个递增,一个递减,位置可以变换。
解法:开两个vector 存数,然后拍个序即可,唯一不合条件的就是某个数出现了多余两次。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn=;
int n;
vector<int>v1,v2;
int a[maxn],cnt[maxn];
bool flag=false;
bool cmp(int x,int y)
{
return x>y;
}
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
cnt[a[i]]++;
if(cnt[a[i]]==)
v1.push_back(a[i]);
else if(cnt[a[i]]==)
v2.push_back(a[i]);
else
flag=true;
}
if(flag)
printf("NO\n");
else
{
printf("YES\n");
sort(v1.begin(),v1.end());
sort(v2.begin(),v2.end(),cmp);
printf("%d\n",v1.size());
for(vector<int>::iterator it=v1.begin();it!=v1.end();it++)
printf("%d ",*it);
printf("\n");
printf("%d\n",v2.size());
for(vector<int>::iterator it=v2.begin();it!=v2.end();it++)
printf("%d ",*it);
printf("\n");
}
return ;
}
D - Equalize Them All CodeForces - 1144D
You are given an array aa consisting of nn integers. You can perform the following operations arbitrary number of times (possibly, zero):
- Choose a pair of indices (i,j)(i,j) such that |i−j|=1|i−j|=1 (indices ii and jj are adjacent) and set ai:=ai+|ai−aj|ai:=ai+|ai−aj|;
- Choose a pair of indices (i,j)(i,j) such that |i−j|=1|i−j|=1 (indices ii and jj are adjacent) and set ai:=ai−|ai−aj|ai:=ai−|ai−aj|.
The value |x||x| means the absolute value of xx. For example, |4|=4|4|=4, |−3|=3|−3|=3.
Your task is to find the minimum number of operations required to obtain the array of equal elements and print the order of operations to do it.
It is guaranteed that you always can obtain the array of equal elements using such operations.
Note that after each operation each element of the current array should not exceed 10181018 by absolute value.
Input
The first line of the input contains one integer nn (1≤n≤2⋅1051≤n≤2⋅105) — the number of elements in aa.
The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (0≤ai≤2⋅1050≤ai≤2⋅105), where aiai is the ii-th element of aa.
Output
In the first line print one integer kk — the minimum number of operations required to obtain the array of equal elements.
In the next kk lines print operations itself. The pp-th operation should be printed as a triple of integers (tp,ip,jp)(tp,ip,jp), where tptp is either 11 or 22 (11 means that you perform the operation of the first type, and 22 means that you perform the operation of the second type), and ipip and jpjp are indices of adjacent elements of the array such that 1≤ip,jp≤n1≤ip,jp≤n, |ip−jp|=1|ip−jp|=1. See the examples for better understanding.
Note that after each operation each element of the current array should not exceed 10181018 by absolute value.
If there are many possible answers, you can print any.
Examples
5
2 4 6 6 6
2
1 2 3
1 1 2
3
2 8 10
2
2 2 1
2 3 2
4
1 1 1 1
0
题意:
给出N个数, 对任意相邻的两个数ai, aj有两种操作:set ai:=ai+|ai−aj|; set ai:=ai−|ai−aj|.
求最少进行多少次操作, 可以使得所有数全部相等。发现对于任意的两个数进行一次操作均可使其相等, 同时可以向左/向右传递.
这样一来使得所有数均为出现次数最多的数毫无疑问就是最优策略了。所以就是找众数,找到之后把其他的往这边转换。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn=;
int n;
vector<int>v1,v2;
int a[maxn],vis[maxn];
int id,maxx;
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
vis[a[i]]++;
if(vis[a[i]]>maxx)
{
maxx=vis[a[i]];
id=i;
}
}
printf("%d\n",n-maxx);
for(int i=id-;i>=;i--)
{
if(a[i]>a[i+])
printf("2 %d %d\n",i,i+);
else if(a[i]<a[i+])
printf("1 %d %d\n",i,i+);
a[i]=a[i+];
}
for(int i=id+;i<=n;i++)
{
if(a[i]>a[i-])
printf("2 %d %d\n",i,i-);
else if(a[i]<a[i-])
printf("1 %d %d\n",i,i-);
a[i]=a[i-];
}
return ;
}
E - Median String CodeForces - 1144E
You are given two strings ss and tt, both consisting of exactly kk lowercase Latin letters, ss is lexicographically less than tt.
Let's consider list of all strings consisting of exactly kk lowercase Latin letters, lexicographically not less than ss and not greater than tt (including ss and tt) in lexicographical order. For example, for k=2k=2, s=s="az" and t=t="bf" the list will be ["az", "ba", "bb", "bc", "bd", "be", "bf"].
Your task is to print the median (the middle element) of this list. For the example above this will be "bc".
It is guaranteed that there is an odd number of strings lexicographically not less than ss and not greater than tt.
Input
The first line of the input contains one integer kk (1≤k≤2⋅1051≤k≤2⋅105) — the length of strings.
The second line of the input contains one string ss consisting of exactly kk lowercase Latin letters.
The third line of the input contains one string tt consisting of exactly kk lowercase Latin letters.
It is guaranteed that ss is lexicographically less than tt.
It is guaranteed that there is an odd number of strings lexicographically not less than ss and not greater than tt.
Output
Print one string consisting exactly of kk lowercase Latin letters — the median (the middle element) of list of strings of length kk lexicographically not less than ss and not greater than tt.
Examples
2
az
bf
bc
5
afogk
asdji
alvuw
6
nijfvj
tvqhwp
qoztvz
题意:给你两个只含有小写字母的字符串, s和t,保证s的字典序比t小。把s和t看成一个26进制的数,让你输出这两个数的中位数
解法:转换为十进制去做,首先把两个字符串的每一个位上的数值加起来,然后向前进位。然后从头开始遍历加起来的那个数值,如果数值为偶数,那么中位数的这一位就是数值/2,如果是奇数,那么中位数的这一位是/2且向下取整。
并把那个多余的一加到下一位中,(注意上一位的1到下一位是26),最后输出答案即可。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn=;
int n;
char s1[maxn],s2[maxn];
int a[maxn],b[maxn];
int ans[maxn];
int id,maxx;
int main()
{
scanf("%d",&n);
scanf("%s",s1);
scanf("%s",s2);
for(int i=;i<n;i++)
{
a[i]=s1[i]-'a'+;
b[i]=s2[i]-'a'+;
}
for(int i=;i<n;i++)
ans[i]=a[i]+b[i];
for(int i=;i<n;i++)
{
if(ans[i]%!=)
ans[i+]+=;
ans[i]=ans[i]/;
}
for(int i=n-;i>=;i--)
{
if(ans[i]>)
{
ans[i]-=;
ans[i-]++;
}
}
for(int i=;i<n;i++)
printf("%c",ans[i]+'a'-);
return ;
}
F - Graph Without Long Directed Paths CodeForces - 1144F
You are given a connected undirected graph consisting of nn vertices and mm edges. There are no self-loops or multiple edges in the given graph.
You have to direct its edges in such a way that the obtained directed graph does not contain any paths of length two or greater (where the length of path is denoted as the number of traversed edges).
Input
The first line contains two integer numbers nn and mm (2≤n≤2⋅1052≤n≤2⋅105, n−1≤m≤2⋅105n−1≤m≤2⋅105) — the number of vertices and edges, respectively.
The following mm lines contain edges: edge ii is given as a pair of vertices uiui, vivi (1≤ui,vi≤n1≤ui,vi≤n, ui≠viui≠vi). There are no multiple edges in the given graph, i. e. for each pair (ui,viui,vi) there are no other pairs (ui,viui,vi) and (vi,uivi,ui) in the list of edges. It is also guaranteed that the given graph is connected (there is a path between any pair of vertex in the given graph).
Output
If it is impossible to direct edges of the given graph in such a way that the obtained directed graph does not contain paths of length at least two, print "NO" in the first line.
Otherwise print "YES" in the first line, and then print any suitable orientation of edges: a binary string (the string consisting only of '0' and '1') of length mm. The ii-th element of this string should be '0' if the ii-th edge of the graph should be directed from uiui to vivi, and '1' otherwise. Edges are numbered in the order they are given in the input.
Example
6 5
1 5
2 1
1 4
3 1
6 1
YES
10100
题意:给定一个无向图,让其把边变成一个有向边,边的方向可以你自己定,but要求最后的图中任何一个路径的长度不能大于等于2。
解法:通过分析我们可以发现,要满足图中的任意一个路径的长度不大于等于2的话,那么对于任意一个节点i,如果它在一个边中做起点,那么就不能在另一个边中做终点。显然一个节点在它连接的所有的边中,只能做起点或者终点。直接dfs 跑染色。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int maxn=;
int n,m;
vector<int>G[maxn];
int u[maxn],v[maxn];
int vis[maxn];
bool flag=false;
void dfs(int x,int pre)
{
vis[x]=pre;
int si=G[x].size();
for(int i=;i<si;i++)
{
int to=G[x][i];
if(vis[to])
{
if(pre==vis[to])
{
flag=;
return ;
}
continue;
}
dfs(to,-pre);
}
return ;
}
int main()
{
scanf("%d %d",&n,&m);
for(int i=;i<m;i++)
{
scanf("%d %d",&u[i],&v[i]);
G[u[i]].push_back(v[i]);
G[v[i]].push_back(u[i]);
}
dfs(,);
if(flag)
printf("NO\n");
else
{
printf("YES\n");
for(int i=;i<m;i++)
printf("%d",-vis[u[i]]);
printf("\n");
}
return ;
}
G - Two Merged Sequences CodeForces - 1144G
Two integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing.
Strictly increasing sequence is a sequence of integers [x1<x2<⋯<xk][x1<x2<⋯<xk]. And strictly decreasing sequence is a sequence of integers [y1>y2>⋯>yl][y1>y2>⋯>yl]. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.
Elements of increasing sequence were inserted between elements of the decreasing one (and, possibly, before its first element and after its last element) without changing the order. For example, sequences [1,3,4][1,3,4] and [10,4,2][10,4,2] can produce the following resulting sequences: [10,1,3,4,2,4][10,1,3,4,2,4], [1,3,4,10,4,2][1,3,4,10,4,2]. The following sequence cannot be the result of these insertions: [1,10,4,4,3,2][1,10,4,4,3,2] because the order of elements in the increasing sequence was changed.
Let the obtained sequence be aa. This sequence aa is given in the input. Your task is to find any two suitable initial sequences. One of them should be strictlyincreasing, and another one — strictly decreasing. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.
If there is a contradiction in the input and it is impossible to split the given sequence aa into one increasing sequence and one decreasing sequence, print "NO".
Input
The first line of the input contains one integer nn (1≤n≤2⋅1051≤n≤2⋅105) — the number of elements in aa.
The second line of the input contains nn integers a1,a2,…,ana1,a2,…,an (0≤ai≤2⋅1050≤ai≤2⋅105), where aiai is the ii-th element of aa.
Output
If there is a contradiction in the input and it is impossible to split the given sequence aa into one increasing sequence and one decreasing sequence, print "NO" in the first line.
Otherwise print "YES" in the first line. In the second line, print a sequence of nnintegers res1,res2,…,resnres1,res2,…,resn, where resiresi should be either 00 or 11 for each ii from 11 to nn. The ii-th element of this sequence should be 00 if the ii-th element of aa belongs to the increasing sequence, and 11 otherwise. Note that the empty sequence and the sequence consisting of one element can be considered as increasing or decreasing.
Examples
9
5 1 3 6 8 2 9 0 10
YES
1 0 0 0 0 1 0 1 0
5
1 2 4 0 2
NO
题意:将一个序列分成两个序列,两个序列中元素的相对顺序保持和原序列不变,使得分出的两个序列一个严格上升,一个严格下降。
解法:对于第 i 个数 , 我们应该分析什么情况可以放入升序什么情况放入降序 ; 最容易的情况就是第 i 个数只能放在特定的一个序列中 , 与都不能放在序列中也就是 NO 的情况 ;
递增序列肯定希望最后一个数最小,递减序列肯定希望最后一个数最大,然而对于ai要么属于递增序列,要么属于递减序列。
因此比较ai和a(i+1)的大小,若ai>a(i+1),则把ai放到递减序列尾部,否则放到递增序列尾部。 注意一下不符合题意的判定以及相等元素的判定就好了。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int INF=0x3f3f3f3f;
const int maxn=;
int n,m;
int a[maxn],ans[maxn];
int maxx,minn;
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
maxx=-INF,minn=INF;
for(int i=;i<=n;i++)
{
if(a[i]<=maxx && a[i]>=minn)
{
printf("NO\n");
return ;
}
else if(a[i]>maxx && a[i]<minn)
{
if(a[i]>=a[i+])
{
minn=a[i];
ans[i]=;
}
else
maxx=a[i];
}
else if(a[i]>maxx)
maxx=a[i];
else
{
minn=a[i];
ans[i]=;
}
}
printf("YES\n");
for(int i=;i<=n;i++)
printf("%d ",ans[i]);
printf("\n");
return ;
}
CF550 DIV3的更多相关文章
- Codeforces #550 (Div3) - G.Two Merged Sequences(dp / 贪心)
Problem Codeforces #550 (Div3) - G.Two Merged Sequences Time Limit: 2000 mSec Problem Description T ...
- codeforces-1144 (div3)
赛后经验:div3过于简单,以后不做了 A.存在以下情况即为NO 1.存在相同字母 2.最大字母-最小字母 != 字符串长度 #include <map> #include <set ...
- 12.27 cf div3 解题报告
12.27 cf div3 解题报告 wxy.wxy,带上分拉,全场做了个无脑小白 比赛场地 A: T1,跟着模拟就好了 B: sort一遍之后 去除的数一定是a[1]或者a[n] 比较去除谁小就输出 ...
- CodeForces 1029E div3
题目链接 第一道场上自己做出来的E题...虽然是div3,而且是原题... 当时做完ABC,D题没有思路就去怼E了,然后发现貌似原题? 事实上就是原题... 给个原题链接... [HNOI2003]消 ...
- CodeForces Round #527 (Div3) B. Teams Forming
http://codeforces.com/contest/1092/problem/B There are nn students in a university. The number of st ...
- 【赛时总结】◇赛时·V◇ Codeforces Round #486 Div3
◇赛时·V◇ Codeforces Round #486 Div3 又是一场历史悠久的比赛,老师拉着我回来考古了……为了不抢了后面一些同学的排名,我没有做A题 ◆ 题目&解析 [B题]Subs ...
- Codeforces Round #535 (Div. 3) [codeforces div3 难度测评]
hhhh感觉我真的太久没有接触过OI了 大约是前天听到JK他们约着一起刷codeforces,假期里觉得有些颓废的我忽然也心血来潮来看看题目 今天看codeforces才知道居然有div3了,感觉应该 ...
- CodeForces Round#480 div3 第2场
这次div3比上次多一道, 也加了半小时, 说区分不出1600以上的水平.(我也不清楚). A. Remove Duplicates 题意:给你一个数组,删除这个数组中相同的元素, 并且保留右边的元素 ...
- codeforces #579(div3)
codeforces #579(div3) A. Circle of Students 题意: 给定一个n个学生的编号,学生编号1~n,如果他们能够在不改变顺序的情况下按编号(无论是正序还是逆序,但不 ...
随机推荐
- POJ2533/hdoj1950【DP】
O(nlog(n))的方法: 定义d[k]:长度为k的上升子序列的最末元素,若有多个长度为k的上升子序列,则记录最小的那个最末元素. d中元素也是单调递增的. #include <iostrea ...
- python 面向对象十二 元类
一.类也是对象 只要使用关键字class,Python解释器在执行的时候就会创建一个对象.下面的代码段: class ObjectCreator(object): pass 将在内存中创建一个对象,名 ...
- bzoj 2131: 免费的馅饼【dp+树状数组】
简单粗暴的dp应该是把馅饼按时间排序然后设f[i]为i接到馅饼能获得的最大代价,转移是f[i]=max(f[j])+v[i],t[j]<=t[i],2t[i]-2t[j]>=abs(p[i ...
- IT兄弟连 JavaWeb教程 经典案例3
案例需求:写一个用户登录的html页面有账号和密码,并在登录的Servlet中获取登录的账号和密码,如果账号是abc密码是123则重定向到main.html,否则重定向到login.html. 案例实 ...
- IT兄弟连 Java Web教程 Tomcat
本文采用的Tomcat服务器版本是Tomcat8.5版本,Tomcat8.5支持Servlet3.1.JSP2.3以及EL3.0规范.并且Tomcat8.5版本对JDK8的支持比Tomcat8更加全面 ...
- .NET Core 跨平台物联网开发:连接阿里云IOT(一)
系列教程目录 (一) 连接阿里云IOT (二) 设置委托事件 (三) 上报属性 (四) SDK文档 属性.方法.委托.类 http://pan.whuanle.cn/index.php?dir=up ...
- pycharm 断点调试
转自; https://blog.csdn.net/chenggong2dm/article/details/9368641 PyCharm 作为IDE,断点调试是必须有的功能.否则,我们还真不如用纯 ...
- nginx媒体压缩
1 gzip模块 参考:http://nginx.org/en/docs/http/ngx_http_gzip_module.html 浏览器的请求头里会表明Accept-Encoding 方式.服务 ...
- 1-8继承extends
什么是继承? 继承是面向对象三大特征之一.java中的继承描述的是两个类之间的关系,被继承的类称为父类,继承的类称为子类,使用extends关键字来表示.在java语言里面只支持单继承,即一个类只能有 ...
- 在sz
在大城市,sz, 每天骑单车去公交车站. 每天用高德地图 坐快线巴士 车上下班要3个小时. 用guomei 的回收管家 回收 旧空调. 我在kfc 看书 在班车上睡觉/眯眼 在办公室睡觉,看书,工作 ...