CF398A Cards | 贪心】的更多相关文章

题目链接 我怎么连这种题都做得那么艰难-- 可以发现一些结论,然后枚举'x'被分成几段就好了. 我真的越来越菜 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int cnt[100005]; int main() { int a=0,b=0,c=0; long long ans=-1e18; scanf("%d%d",&a,&b);…
题目链接: http://codeforces.com/problemset/problem/777/B 题目大意: A, B玩游戏,每人一串数字,数字不大于1000,要求每人从第一位开始报出数字,并且比较,如果等于则没事,A>B则B被打一下,反之A被打一下,A很老实不会耍计谋,老老实实从第一个开始报,但是B很狡猾,会改变数字的顺序.问2个次数,一个是B最小被打的次数,二是A最多被打的次数. 思路: 贪心,模拟一下就行了.这里用到了cmp的技巧,直接用字符比较,这样就省去了转换为字符串的步骤.…
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-…
There are nn players sitting at the card table. Each player has a favorite number. The favorite number of the jj-th player is fjfj. There are k⋅nk⋅n cards on the table. Each card contains a single integer: the ii-th card contains number cici. Also, y…
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 \(…
对第一个人的排序,然后从小到大处理,对第一个人的每枚卡片,从第二个人的卡片中选择一个大于等于它的最小的,否则选择一个当前剩下的最小的,这样可以保证负场最少. 如果选择的改成大于它的最小的,就可以保证胜场最多. 用multiset处理. #include<cstdio> #include<set> #include<algorithm> using namespace std; typedef pair<int,int> Point; Point c[1010…
该题难点在于求最小的离开数,最大的没什么好说的,关键是求最小的. 可以这样去想,最小的离开数就是每个人获得的牌数等于他所能接受的最大牌数-1,这样就可以直接比较m=a1(k1-1)+a2(k2-1)与n的大小,n-m即为最小的离开数. #include<iostream> #include<cstdio> #include<cstring> #include<map> #include<algorithm> #include<cmath&g…
B - B Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Appleman has n cards. Each card has an uppercase letter written on it. Toastman must choose k cards from Appleman's cards. Then Appleman sho…
Alice and Bob Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3716 Accepted Submission(s): 1179 Problem Description Alice and Bob's game never ends. Today, they introduce a new game. In this game…
Problem Description Alice and Bob's game never ends. Today, they introduce a new game. In this game, both of them have N different rectangular cards respectively. Alice wants to use his cards to cover Bob's. The card A can cover the card B if the hei…