https://vjudge.net/contest/587311#problem/J
我也不知道我在此题中学到了什么套路
结论:你选的数必须尽量接近 s u m 3 \frac {sum} 3 3sum,然后这个就是解
因为另外两人选的是和你的数相比不可能更接近,所以必然一个大一个小
唯一的…
题目内容 原题链接 给定一个区间 [ A , B ] [A,B] [A,B] ,从中选出两个数 x x x 和 y y y , x x x 可以等于 y y y ,问 x x x 或 y y y 的结果可以得到多少个不同的数。
数据范围 0 ≤ A ≤ B < 2 60 0\leq A\leq B<2^{60} 0≤A…
题面 题意 给你 a , b 两个矩阵,问通过翻转(0变1,1变0)能否使a变成b翻转必须是整行或者整列翻转 思路 像这种翻转题,一般先看规律,我们会发现,每行或每列只需要翻转0或者1次,因为翻转…
比赛链接
好忙好忙好忙,慢慢补老比赛的题解了。
这场没啥算法,全是思维。有也是BFS,屎。 A. Special Characters
题意:
您将得到一个整数 n n n 。
您的任务是构建一串大写的拉丁字母。此字符串中必须正好有 n n n 个特殊字…
问题 B: Balanced Neighbors
时间限制: 1 Sec 内存限制: 128 MB 提交: 83 解决: 43 [提交] [状态] [命题人:admin]
题目描述
You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: …
适配一个容器以提供优先级队列
std::priority_queue
定义于头文件 <queue>
template< class T, class Container std::vector<T>, class Compare std::less<typename Container::value_type> > class priority_queue;
priority_queu…
G - Non-Puzzle: Game
题目大意
一开始有 n n n 个数,Alice和Bob轮流操作,每次操作可以选择任意两个数(可以是同一个数)进行异或并添加到数组中,谁在一次操作后得到的数为 k k k 谁就获胜,问最后谁赢或…
http://cplusoj.com/d/senior/p/SS231116D
假设我们要把 a a a 变成 b b b,我们在 a i a_i ai 和 a i 1 a_{i1} ai1 之间连边, b b b 同理,则 a a a 能变成 b b b 的充要条件是两图 A , B A,B A,B 同构。
必要性显然࿰…
题目链接:https://ac.nowcoder.com/acm/contest/330/B题目描述
精通程序设计的 Applese 又写了一个游戏。在这个游戏中,它位于一个 n 行 m 列的方阵中的左上角(坐标为(0, 0),行的序号为0∼n−10∼n−1,列的序号为0∼m…
Problem - 1333A - Codeforces
解析: 只需要在左上角放一个白色,其余都放黑色即可满足条件。
#include<bits/stdc.h>
using namespace std;
int t,n,m;
signed main(){scanf("%d",&t);while(t--){scanf("%d%d",&n,&…
Problem - 1367C - Codeforces 解析: 统计出所有连续0序列,并且记录其左右两侧有没有1,然后对于四种情况分别判断即可。
#include<bits/stdc.h>
using namespace std;
int t,n,k;
signed main(){scanf("%d",&t);while(…
Problem DescriptionThe harmonic value of the permutation p1,p2,⋯pnis∑i1n−1gcd(pi.pi1)Mr. Frog is wondering about the permutation whose harmonic value is the strictly k-th smallest among all the permutations of [n].InputThe first line contains only one i…
正题
题目链接:https://codeforces.com/contest/1773/problem/K 题目大意
要求构造一张 n n n 个点的无向图满足。
不存在重边和自环,且图连通所有点的度数恰好有 k k k 个不同的值 1 ≤ k ≤ n ≤ 500 1\leq k\leq n\leq 500 1≤k≤n≤500 解题思路
非常好构…