Codeforces Round #201.C-Alice and Bob】的更多相关文章

B. Alice, Bob, Two Teams 题目连接: http://www.codeforces.com/contest/632/problem/B Description Alice and Bob are playing a game. The game involves splitting up game pieces into two teams. There are n pieces, and the i-th piece has a strength pi. The way…
C. Alice and Bob time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follow…
数论: C. Alice and Bob time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as fo…
题目链接:http://codeforces.com/contest/347/problem/C 题意是给你一个数n,然后n个数,这些数互不相同.每次可以取两个数x和y,然后可以得到|x - y|这个数,要求不在这个数组中,然后添加进去,直到不能取为止,不能取的人输了.Alice先取,求谁最后能赢. 可以先列举几种情况,可以发现,一般情况取到最后剩下1~max这些数了.但是要是比如原来的数有3 12这两个数,那最后就会剩下3 6 9 12这4个数,由此可以看出这种情况下剩下的一定是原来数的gcd…
cf 上的一道好题:  首先发现能生成所有数字-N 判断奇偶 就行了,但想不出来,如何生成所有数字,解题报告 说是  所有数字的中最大的那个数/所有数字的最小公倍数,好像有道理:纪念纪念: #include<iostream> #include<stdio.h> #include<algorithm> #include<cstring> #include<algorithm> #include<cmath> using namespa…
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); ; i < n; ++ i ) cin >>a[i]; sort(a.begin(),a.end()); swap(a[],a[n-]); ; i < n; ++i) co…
题意:给定两个串,求出两个串的最长公共子序列,要求该公共子序列不包含virus串. 用dp+kmp实现 dp[i][j][k]表示以i结尾的字符串和以j结尾的字符串的公共子序列的长度(其中k表示该公共子序列的与virus的匹配程度)很显然,当k==strlen(virus)时,该公共子序列不是我们所求得 当添加一个字符时,如果失配,这时不能让k直接等于0,而是要用kmp给k一个合理的值. #include <stdio.h> #include <string.h> + ; int…
Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description You are given a sequence of positive integers x1, x2, ..., xn and two non-negative integers a and b. Your task is to transform a into b. To do that, you can per…
It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either…
Codeforces Round #557 (Div. 1) 简要题解 codeforces A. Hide and Seek 枚举起始位置\(a\),如果\(a\)未在序列中出现,则对答案有\(2\)或\(3\)的贡献. 若\(a\)在序列中出现,找到\(a\)第一次出现的位置\(x\),则说明在\(x\)位置之前需要把\(a\)移动到\(a+1\)或\(a-1\)处,只需要判断\(x\)后面有没有\(a+1\),有没有\(a-1\).对每种数字记录第一次和最后一次出现位置即可. code B…