[codeforces 293]A. Weird Game】的更多相关文章

[codeforces 293]A. Weird Game 试题描述 Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of them. Each word consist…
[codeforces 293]B. Distinct Paths 试题描述 You have a rectangular n × m-cell board. Some cells are already painted some of k colors. You need to paint each uncolored cell one of the k colors so that any path from the upper left square to the lower right…
B. Weird Subtraction Process   time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have two variables a and b. Consider the following sequence of actions performed with these variables: If …
[题目链接]:http://codeforces.com/problemset/problem/789/D [题意] 给你n个点,m条边; 可能会有自环 问你有没有经过某两条边各一次,然后剩余m-2条边,每条边各2次的 遍历方案,有的话输出方案数 [题解] /* 把每条边都复制一条相同的边; 然后问题就能转化为在2*m条边中,去掉两条边; 然后使得剩下的图能够进行一笔画(每条边都只经过一次) 则使奇点的个数为0或为2就好了; 考虑自环边和普通边; 对于普通边来说: ①如果删掉的两条普通边是不相邻…
[题目链接]:http://codeforces.com/contest/779/problem/B [题意] 问你要删掉几个数字才能让原来的数字能够被10^k整除; [题解] /* 数字的长度不大; 让你删掉最小的数字个数 使得这个数字能被10^k整除; 搜索; 枚举哪些数字被删掉了; bool记录; 最后再全部乘起来; 枚举删掉1个,删掉两个即可.3.4...; 注意前导0只能有一个的情况就好 */ [完整代码] #include <bits/stdc++.h> using namespa…
  计蒜客)翻硬币 //暴力匹配 #include<cstdio> #include<cstring> #define CLR(a, b) memset((a), (b), sizeof((a))) using namespace std; int n, m, t; int main() { int i, j, x; scanf("%d", &t); while(t--) { scanf("%d%d", &n, &m)…
D. Weird Chess Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/D Description Igor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of th…
F. Ehab and a weird weight formula 题目链接:https://codeforces.com/contest/1088/problem/F 题意: 给出一颗点有权值的树,满足只有一个点的权值最小,然后除开这个点,每个点都有一个权值比它更小的点与之相邻. 然后要求你重构这颗树,满足点权及边权和最小. 点权计算方法: au = au*num(num为与之相邻边的个数); 边权计算方法: e{u,v},we = dis(u,v)*min(au,av)  (dis(u,v…
题目链接:http://codeforces.com/problemset/problem/788/B B. Weird journey time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little boy Igor wants to become a traveller. At first, he decided to vi…
codeforces 407 div1 B题(Weird journey) 传送门 题意: 给出一张图,n个点m条路径,一条好的路径定义为只有2条路径经过1次,m-2条路径经过2次,图中存在自环.问满足条件的路径数 题解: 推论:对于一条边u-->v,我们将其选作为那两条边之一,那么剩下一条边必然与之相邻或者是自环,因为这样才能满足这两条边只走1次. 那么这条边的贡献值为这条边的相邻边数+自环数,假如这条边本身为自环,那么由于剩下的边可以任选(前一个推论),贡献值为m-1 这个AC时间很6啊23…