A. Vasya and Football 题目连接: http://codeforces.com/contest/493/problem/A Description Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player wh…
题意:有一组数,问子数组和最大不超过\(t\)的最多元素个数. 题解:用数组模拟队列,不断的往里面放,队列中的元素之和大于\(t\),就不断地从队头弹出直到满足条件,维护一个最大值即可. 代码: int n,t; int a[N]; int q[N]; int hh,tt=-1; int main() { //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); n=read(),t=read(); for(int i=1;i<=n;++i) a…
浪在ACM 集训队第十次测试赛 A Diverse Substring B Vasya and Books C Birthday D LCM A 传送门 题解 B 传送门 题解: 这道题,就比较简单了,直接用队列模拟一下就好了,话不多说,上代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; #define mem(a,b) memset(a,b,sizeof(a)…
http://codeforces.com/contest/1073 A. Diverse Substring #include <bits/stdc++.h> using namespace std; #define ll long long #define minv 1e-6 #define inf 1e9 #define pi 3.1415926536 #define nl 2.7182818284 ; ; char s[maxn]; int main() { int n,i; scan…
写之前,先发表下感慨:好久没写题解了,也许是因为自己越来越急利了,也可以说是因为越来越懒了. A. Diverse Substring 直接找一找有没有相邻的两个不同的字符即可. B. Vasya and Books 分别记录书本摆放顺序$a[]$,取书顺序$b[]$,每本书的位置$pos[]$,每本书在不在书堆上$in[]$,书堆最顶端的书的位置$top$(因为用的是数组,元素位置是固定的). 然后,按照题意枚举输入的取书顺序$b[]$,同时记录答案$ans$,更新$top$即可. C. Va…
CF1082A Vasya and Book 模拟一下即可 \(Code\ Below:\) #include <bits/stdc++.h> using namespace std; const int inf=0x3f3f3f3f; int n,x,y,d,ans; int main() { int T; scanf("%d",&T); while(T--){ scanf("%d%d%d%d",&n,&x,&y,&am…
After I read the solution to the problem, I found that my solution was simply unsightly. Solved 4 out of 7, and my solution to C was hacked, because of my incorrect order when i meet in the middle. I wasted about 20 mins on problem A due to the incom…