浙南联合训练赛 B-Laptops】的更多相关文章

One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (…
Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the number of different positions Pe…
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59. You are gi…
本场比赛的三个水题之一,题意是两个玩家每人都持有一手牌,问第一个玩家是否有一种出牌方法使得在第一回和对方无牌可出.直接模拟即可,注意一次出完的情况,一开始没主意,wa了一发. #include<cstdio> #include<string> #include<cstring> #include<iostream> #include<algorithm> using namespace std; char s[3][30]; int player…
第6题是利用周期性求解, 第7题是 (总的序列长度-最长的满足要求的序列长度) 第8题是 设定起点,可以找到最早出现的不满足条件,然后后面都是不满足的,利用队列求解这个过程 大神给的简单,精炼的题解. 1. 消除之王 数据量为4*4,所以直接暴力dfs的层数不会超过8层,也就是dfs的复杂度为8!,然后加上一些模拟掉落的操作,总的复杂度也不会大. 2. NC 大数开根求整数部分. 网上大神有直接的模板 附模板一份: #include <stdio.h>#include <string.h…
The sum of gcd Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 23    Accepted Submission(s): 4 Problem Description You have an array A,the length of A is n Let f(l,r)=∑ri=l∑rj=igcd(ai,ai+1....a…
构造题: 比赛的时候只想到:前面一样的数,后面 是类似1,2,3,4,5,6....t这 既是:t+1,t+1...,1,2,3,...t t+1的数目 可能 很多, 题解时YY出一个N 然后对N  判断. seg{Li*(Li-1)} = n*n+n-2*k=d; 每次跑sqrt(n)找到 最近的 d ,D_new=d-Li*(Li-1); 这样一定能解的:d 一定是偶数,Li*(Li-1)也一定是偶数,2*1=2; 还有seg(Li)=n; 当Li=1是 Li*Li-Li=0; 加入一些1就…
First One Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 142    Accepted Submission(s): 37 Problem Description soda has an integer array a1,a2,-,an. Let S(i,j) be the sum of ai,ai+1,-,aj. No…
In Touch Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 67    Accepted Submission(s): 11 Problem Description There are n soda living in a straight line. soda are numbered by 1,2,-,n from lef…
pid=5358">HDU 5358 题意: 求∑​i=1​n​​∑​j=i​n​​(⌊log​2​​S(i,j)⌋+1)∗(i+j). 思路: S(i,j) < 10^10 < 2^34.所以log2(S)+1的值仅仅可能在1~35之间.因为log变化缓慢的函数特性,我们能够S(i,n)分作多个同样log值的区间来计算,用pos[i][j]预处理记录每一个以i为起点,log(s)值为j的区间的右边界.就可以优化至nlogn的复杂度. 主要是写起来比較难一些,一些细节比較纠结,…