Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just de…
E. Simple Skewness time limit per test:3 seconds memory limit per test:256 megabytes input:standard input output:standard output Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list…
/* 题意:给出立方体的每个顶点的坐标(是由源坐标三个数某几个数被交换之后得到的!), 问是否可以还原出一个立方体的坐标,注意这一句话: The numbers in the i-th output line must be a permutation of the numbers in i-th input line! 思路: 我们只要对输入的每一行数据进行枚举每一个排列, 然后检查时候能构成立方体就好了! 检查立方体:找到最小的边长的长度 l, 统计边长为l, sqrt(2)*l, sqrt…
You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('R', 'G' and 'B' — colors of lamps in the garland). You have to recolor some lamps in this garland (recoloring a lamp means chang…
题意:进行若干场比赛,每次比赛两人对决,赢的人得到1分,输的人不得分,先得到t分的人获胜,开始下场比赛,某个人率先赢下s场比赛时, 游戏结束.现在给出n次对决的记录,问可能的s和t有多少种,并按s递增的方式输出. 析:如果枚举s 和 t,那么一定会超时的,所以我们考虑是不是可以不用全枚举.我们只要枚举 t ,然后每次都去计算 s. 首先我们先预处理两个人的获得第 i 分时是第几场比赛.然后每次枚举每个 t,每次我们都是加上t,所以总的时间复杂度为 n*logn. 完全可以接受,注意有几个坑,首先…
暴力. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; struct X { +]; int len; int num; ]; }s[]; int n; int main() { scanf("%d",&n); ;i<=n;i++) { scanf("%s",s[i].s…
A. Flipping Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub got bored, so he invented a game to be played on paper. He writes n integers a1, a2, ..., an. Each of those integers c…