Kickstart Practice Round 2017---A】的更多相关文章

Problem B. Vote A and B are the only two candidates competing in a certain election. We know from polls that exactly N voters support A, and exactly M voters support B. We also know that N is greater than M, so A will win. Voters will show up at the…
Problem The Constitution of a certain country states that the leader is the person with the name containing the greatest number of different alphabet letters. (The country uses the uppercase English alphabet from A through Z.) For example, the name G…
Speed Typing 题意概述 给出两个字符串I和P,问能否通过删除P中若干个字符得到I?如果能的话,需要删除字符的个数是多少? 数据规模 \[1≤|I|,|P|≤10^5 \] 双指针 设置两个指针i和j分别指向I和P的第一个字符,滑动指针j,如果j指向的字符与i指向的字符相同,则让i向后滑动一个字符,当i滑动到I字符串末尾或j滑动到P字符串末尾后即可结束循环.如果i滑动到I字符串末尾,则说明可以通过删除P中若干个字符得到I,那么删除的字符个数为\(|P|-|I|\):反之则不能. 复杂度…
今天有Google of Greater China Test for New Grads of 2014的练习赛,主要是为了过几天的校园招聘测试做练习用的,帮助熟悉平台,题目嘛,个人觉得除了A题外,B和C就是练习基本编程的. A题:Bad Horse二分图判定问题.话说昨晚刚简单看了一下代码,写都没写过,只好翻书抄代码了...还是有点幸运的,如果昨天没看,这个题估计就要留白了...感觉还有好多东西没学啊... #include <cstdio> #include <iostream&g…
A. Arpa and a research in Mexican wave time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. They…
题意 一个竞赛图的度数集合是由该竞赛图中每个点的出度所构成的集合. 现给定一个 \(m\) 个元素的集合,第 \(i\) 个元素是 \(a_i\) .(此处集合已经去重) 判断其是否是一个竞赛图的度数集合,如果是,找到点数最小的满足条件的竞赛图,并构造方案. \(m, a_i \le 30\) ,\(a_i\) 互不相同. 题解 首先给出结论:假如给出每个点的出度,那么这些点能形成一个竞赛图当且仅当排序后的序列 \(d_1, d_2, d_3, \dots , d_n\) 满足对于所有 \(k…
http://codeforces.com/contest/851/problem/D 分区间操作 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <time.h> #include <string> #include <set> #include <map> #include <list&…
题意:给你n个数,一次操作可以选一个数delete,代价为x:或者选一个数+1,代价y.你可以进行这两种操作任意次,让你在最小的代价下,使得所有数的GCD不为1(如果全删光也视作合法). 我们从1到max(ai)枚举最后都变成的gcd是多少,假设为g,那么所有数都必须变成一个比g大的最小的g的倍数k·g.枚举k,然后在一个区间[(k-1)*g+1,k*g]里,一定存在一个分界点f,使得小于等于f的数全都删去,因为删除的代价小于把它们都变成kg的代价:大于f的数全都变成kg.因为x<=(kg-ai…
题意:给你五维空间内n个点,问你有多少个点不是坏点. 坏点定义:如果对于某个点A,存在点B,C,使得角BAC为锐角,那么A是坏点. 结论:如果n维空间内已经存在2*n+1个点,那么再往里面添加任意多个点,就会导致所有点都变成坏点. 容易看出来(?),把2*n+1个点分别放在原点处和每个坐标轴的正负半轴上各一个比较优. 所以n>11时,直接输出零,否则暴力枚举. #include<cstdio> using namespace std; typedef long long ll; stru…
题意:给你平面上3个不同的点A,B,C,问你能否通过找到一个旋转中心,使得平面绕该点旋转任意角度后,A到原先B的位置,B到原先C的位置. 只要A,B,C构成等腰三角形,且B为上顶点.那么其外接圆圆心即是一个合法的旋转中心.画个图很显然. 注意A,B,C三点共线时不可. #include<cstdio> using namespace std; typedef long long ll; struct Point{ ll x,y; Point(const ll &x,const ll &…