题目链接: http://codeforces.com/problemset/problem/777/B 题目大意: A, B玩游戏,每人一串数字,数字不大于1000,要求每人从第一位开始报出数字,并且比较,如果等于则没事,A>B则B被打一下,反之A被打一下,A很老实不会耍计谋,老老实实从第一个开始报,但是B很狡猾,会改变数字的顺序.问2个次数,一个是B最小被打的次数,二是A最多被打的次数. 思路: 贪心,模拟一下就行了.这里用到了cmp的技巧,直接用字符比较,这样就省去了转换为字符串的步骤.…
B. Game of Credit Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and deci…
After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards. Rules of this game are simple: each player bring his favourite n-…
After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards. Rules of this game are simple: each player bring his favourite \(…
B. Game of Credit Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and deci…
B. Game of Credit Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and deci…
题目连接:Codeforces 437C  The Child and Toy 贪心,每条绳子都是须要割断的,那就先割断最大值相应的那部分周围的绳子. #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; const int MAX_N = 1000 + 10; int G[MAX_N][MAX_N]; struct…
https://codeforces.com/contest/1136/problem/D 贪心 + 思维 题意 你面前有一个队列,加上你有n个人(n<=3e5),有m(m<=个交换法则,假如u在v相邻前面,那么u和v可以交换位置,问你是队列最后一个人的时候你最前可以换到前面哪里 题解 因为相邻才能换,所以最后一个换到前面一定是一步一步向前走,所以不存在还要向后走的情况 设最后一个为u,假设前面有一个能和u换位置的集合,那么需要将这些点尽量往后移动去接u 假设前面有一个不能和u换位置的集合S,…
After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards. Rules of this game are simple: each player bring his favourite n-…
[题目链接]:http://codeforces.com/contest/777/problem/B [题意] 等价题意: 两个人都有n个数字, 然后两个人的数字进行比较; 数字小的那个人得到一个嘲讽; 问你如何搞 才能让莫里亚蒂得到的嘲讽最少; 莫里亚蒂得到的嘲讽最多; [题解] /* 先考虑莫里亚蒂得到最小的; 先把夏洛克的从小到大排序 然后从小到大处理夏洛克的数字; 对于夏洛克的每一个数字x 尝试用一个>=x的但是最小的数来击败它.然后这个数打上标记; 如果找不到大于等于它的数字,那么就结…