Codeforces 1215D. Ticket Game】的更多相关文章

Codeforces 1215D Ticket Game 原题 题目 Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The numbe…
传送门 博弈,发现情况有点多,分析一下把有用的状态提取出来 显然各个位置的数字是没用的,我们只要知道两边的数字和分别是多少 并且状态显然和左右两边的 "?" 数量有关 因为最终我们只在意左右是否相等,即差值是否为 $0$ 所以两边的数字和分别是多少也不必要,我们只要知道两边数字的差即可 再分析一下,对于当前某种两边都有 "?" 的情况,先手走了对他最优的决策,使数字差往对他有利的方向发展 后手显然可以在另一边做同样的决策,使得数字差又变回来,即后手可以抵消先手的决策…
题目描述 Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of digits that have been era…
题目大意 洛谷链接 给出一个长度为\(n\)的由数字组成的字符串(\(n\)是偶数).但可能有偶数个位上的数字为?. 现在有两个人\(A\)和\(B\),在?的位置上填\(0\)~\(9\)的数,一直到填完. 让\(A\)先手,若最后该字符串的左半边数字和等于右半边数字和 ,则\(B\)胜利,否则\(A\)胜利. 样例输入 8 ?054??0? 样例输出 Bicarp PS:更多样例和数据范围请打开原题链接吧,实在懒得粘了orz 思路 简单分情况讨论一下就可了. 设左半部分数字和为\(x\),?…
Lucky Ticket Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 146A Description Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal…
任意门:http://codeforces.com/contest/1058/problem/C C. Vasya and Golden Ticket time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Vasya found a golden ticket — a sequence which consists…
链接: https://codeforces.com/contest/1215/problem/D 题意: Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have bee…
题目链接:Buy a Ticket 题意: 给出n个点m条边,每个点每条边都有各自的权值,对于每个点i,求一个任意j,使得2×d[i][j] + a[j]最小. 题解: 这题其实就是要我们求任意两点的最短路,但是从点的个数上就知道这题不可以用floyd算法,其实多元最短路可以用dijkstra算.@.@!把所有的点的权值和点放到结构体里面,放入优先队列,其实这样就能保证每次拓展到的点就是这个点的最短路(因为是优先队列,保证拓展到的点这时候的值是最小的),其实就是这个点想通就很简单. #inclu…
D. Buy a Ticket time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tou…
题目链接  Buy a Ticket 题意   给定一个无向图.对于每个$i$ $\in$ $[1, n]$, 求$min\left\{2d(i,j) + a_{j}\right\}$ 建立超级源点$n+1$, 对于每一条无向边$(x, y, z)$,$x$向$y$连一条长度为$2z$的边,反之亦然. 对于每个$a_{i}$, 从$i$到$n+1$连一条长度为$a_{i}$的边,反之亦然. 然后跑一边最短路即可. #include <bits/stdc++.h> using namespace…