D. Hot Days time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The official capital and the cultural capital of Berland are connected by a ...
Shaass and Oskols time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to nfrom top to bottom. On each wire there are some o...
A. Bits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Lets denote as the number of bits set (1 bits) in the binary representation of t...
C. Little Elephant and LCM time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output The Little Elephant loves the LCM (least common multiple) ope...
A wool sequence 表示一个序列中可以找到一个连续的子区间使得区间异或值为0 那么求的是不含这种情况的序列个数 题目中数据范围是,在0~2^m - 1中选n个数作为一个序列 n和m都是10^5 仔细思考一下。 第一位 有2^m-1种情况 第二位由于不能跟其一样 有2^m-2种情况 第三位由于不能跟第二位一样,并且不能跟前两位的异或值一样,有2^m-3种情况 依次类推,得到公式 (2^m-1)*(2^m-2...
B. Maximum Value time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a sequence a consisting of n integers. Find the maximum po...
B. Maximum Value time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of ai divided by aj), where 1?≤?i,?j?≤?n and ai?≥?aj. ...
这个场由于系统出问题 unrated了 题目都还挺短小精悍的 A 题目大意是 有n个询问(10^4),每个询问是找出在[l,r]区间内二进制位1最多的数 l,r范围是10^18 然后就是贪心。 用 l 从低位往上贪就行了,0变1如果不超范围就变 long long l, r;int n;int main(){ scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%I64d%I64d", &l, &r); for(int j = 0; j < 61; j++) { long long tmp...
D. Kindergarten time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In a kindergarten, the children are being divided into groups. The teacher put the children in a line and associated each child with his or her integer charisma value. ...
题目地址:http://codeforces.com/contest/485 A题:Factory 按照过程模拟,并判断是否出现循环,如果出现循环,说明肯定不可能,直接跳出。 代码如下: #include #include #include #include using namespace std;int _hash[100001];int main(){ int a, m, i, flag=0; memset(_hash,0,sizeof(_hash)); scanf("%d%d",&a,&m); a=a%m; _hash[a]=1; while(1) { a=a*2%m; if(a==0) { ...
链接:http://codeforces.com/contest/485 A. Factory time limit per test 1 second memory limit per test 256 megabytes One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there werex det...
B. Interesting Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Well call an array of n non-negative integers a[1],?a[2],?...,?a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers...
A题:http://codeforces.com/contest/486/problem/A 分析:分析下奇偶就出来结果了 代码: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;typedef long long ll;const int N=100010;ll arr[N];ll dp[110][2];ll n,m;int main(){ while(cin>>n) { ...
D. Valid Sets time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you know, an undirected connected graph with n nodes and n?-?1 edges is called a tree. You are given an integer d and a tree consisting of n nodes. Each node i has a va...
嘎嘎,今天被一些事耽误了,但是还是A了几个题目,这道题还不错 题目链接: 题意:两个人玩游戏,有N堆纸牌,纸牌上有数字,A每次只能取N堆中的 其中一个的顶部的 纸牌,B只能取N堆中的其中一个底部 的纸牌,A,B都想让自己取的和最大,问最后比分为多少 画了一下,如果某一堆里的 纸牌数量为偶数,发现其实是两个人各分一半,因为如果对方想从这里拿走本来属于自己那半部分的 较大的牌,自己完全来得及阻止的, 接下来就...