cf-1230C Anadi and Domino】的更多相关文章

题目链接:http://codeforces.com/contest/1230/problem/C C. Anadi and Domino time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output   题目大意: 两个骰子可以进行组合,第一个大于等于第二个骰子,每个骰子6种情况所以一共有21中图形.给一个无向图,向边上放置上述图…
C. Anadi and Domino 题目链接:https://codeforces.com/contest/1230/problem/C Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every aa and bb such that 1≤a≤b≤61≤a≤b≤6, there is exactly one domino with aa dots o…
C - Anadi and Domino 参考:Anadi and Domino 思路:分为两种情况: ①n<=6,这个时候肯定可以保证降所有的边都放上一张多米诺牌,那么答案就是m ②n==7,在这种情况下肯定会出现某两个点a和b是靠一张两端同点数的多米诺牌连接起来的,而这个时候如果又有一个点同时与这两个点a和b都有一条边,那么,只能够在其中一条边上放多米诺牌,而另外一边不可以.那么我们就可以将它分成两部分,一个是连接a的边,一个是连接b的边,那么为了连接更多的边,那么我们只需要得出我们最少的不…
链接: https://codeforces.com/contest/1230/problem/C 题意: Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1≤a≤b≤6, there is exactly one domino with a dots on one half and b dots on th…
思路: 很有意思的思维题. 实现: #include <bits/stdc++.h> using namespace std; int check(vector<int>& v, set<pair<int, int>>& st) { ; map<pair<int, int>, int> mp; ; i <= ; i++) { ; j++) { mp[make_pair(i, j)] = ; } } for (au…
题目链接:http://codeforces.com/contest/1230/problem/C 题意: 有21 个多米诺骨牌,给定一个无向图(无自环,无重边),一条边上可以放一个多米诺骨牌.如果两条边连接同一个顶点,那就必须使这两条边上指向这个顶点的多米诺骨牌的值相等,问给定的图中最多可以放多少个多米诺骨牌. 题解: **当n<7时,每个节点对应一个数,可放置的骨牌即为m. **当n=7时,此时多出了一个节点,那么还有一个节点必定要放重复的数,节点个数很少吗,故我们可以三重循环,cnt记录有…
1. CF 438D The Child and Sequence 大意: n元素序列, m个操作: 1,询问区间和. 2,区间对m取模. 3,单点修改 维护最大值, 取模时暴力对所有>m的数取模. 因为取模后至少减半, 复杂度$O(nlognlogC)$ 2. CF 431E Chemistry Experiment 大意: n个试管, 第$i$个试管有$a_i$单位水银, m个操作: 1, 修改$a_x$改为$v$. 2, 将$v$单位水倒入试管, 求一种方案使得有水的试管水银与水总量的最大…
传送门 A. Dawid and Bags of Candies 乱搞. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(x) (int)(x).size() //#define Local using namespace std; typedef long long ll; typedef pair<int, int> pii; con…
Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) C. Magic Grid 这种题直接构造 数n是2的n次方的倍数的时候可以这样划分数 比如n是4的倍数  n=k*4 000        001         010         011 100        101         110         111 (k-1)00   (k-1)01   (k-1)10   (k-1)11 然后填格子 Codeforces R…
题目链接: 传送门 Domino Effect time limit per test:1 second     memory limit per test:256 megabytes Description Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the…