首页 > TAG信息列表 > Anton

Anton and Tree

link 树的直径的好题。 首先可以想到把相邻的颜色相同的点合并起来,于是就得到了一棵任意一条边两端颜色都不相同的新树,这样一来操作的过程就是先找一个点,然后把它变成相反的颜色,于是所有和这个点相邻的点全部被这个点收购了;然后这个大点再向四周扩展,于是就这么一层一层地,于是发现

CF734B Anton and Digits 题解

Content 有 \(k_2\) 个 \(2\)、\(k_3\) 个 \(3\)、\(k_5\) 个 \(5\) 和 \(k_6\) 个 \(6\),你可以用这里面的数字来组成 \(256,32\) 两种数字,试求出组成数字的总和的最大值。 数据范围:\(0\leqslant k_2,k_3,k_5,k_6\leqslant 5\times 10^6\)。 Solution 我们很容易想到这样一个贪心

Problem 734A Anton and Danik (from Codeforces 800)

Problem Description Anton likes to play chess, and so does his friend Danik. Once they have played n games in a row. For each game it's known who was the winner — Anton or Danik. None of the games ended with a tie. Now Anton wonders, who won more gam

Codeforces Round #726 (Div. 2),A~B题

题目提交链接 A题:Arithmetic Array 题意: ——给出长度为n的数组。你可以在该数组的后面添加任意的非负数,使得最后的该数组的平均值为1,问最少添加几个非负数可以达到要求。 题解: ——水题,略。 代码: #include<stdio.h> #include<string.h> #include<algorithm> using namespace

CodeForces 734E-Anton and Tree(并查集缩点+树的直径)

题目链接:https://codeforces.com/problemset/problem/734/E 博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13417220.html Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are n vertices in th

CodeForces - 1526D Kill Anton(模拟)

题目链接:https://vjudge.net/problem/CodeForces-1526D 题目大意:给出一个只有四种字母组成的字符串 A A A,要求将其重排列 B

A. Anton and Letters//codeforces38

Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a closing curve

Kind Anton CodeForces - 1333B思维

Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem: There are two arrays of integers aa and bb of length nn. It turned out that array aa contains only elements from the set {−1,0,1}{−1,

石油大学----手速赛第三场补题(三)

明若清溪天下绝歌 缱绻成说,不知该在哪处着墨;一生情深怎奈何世事 徒留斑驳,只一念痴恋成奢。 目录                                                Anton and Polyhedrons                                                

【CF734F】Anton and School(构造)

【CF734F】Anton and School(构造) 题面 Codeforces 洛谷 题解 算是一道\(easy\)? 发现\((a\&b)+(a|b)=a+b\)。 那么根据给定条件我们就能确定唯一的\(a\)数列,最后再带回去\(check\)一下就做完了??? #include<iostream> #include<cstdio> using namespace std; #define ll long long #de

CF734F. Anton and School

思路: 性质题。  (a&b)+(a|b)=a+b。于是可以构造出一组满足这一位满足 $(b[i]+c[i])$ 的唯一一组解,在对于这组解去验证答案是否正确,若不正确则无解。 以下代码: #include<bits/stdc++.h>#define il inline#define LL long long#define _(d) while(d(isdigit(ch=getchar())))using

Codeforces 584E Anton and Ira

Anton and Ira 我们把点分为三类, 向左走的, 向右走的, 不动的。 最完美的情况就是每个点没有走反方向。 每次我们挑选最右边的向右走的去把向左走的交换过来,这样能保证最优。 #include<bits/stdc++.h>#define LL long long#define fi first#define se second#define mk make_pair#de