Codeforces 803E - Roma and Poker】的更多相关文章

http://codeforces.com/problemset/problem/803/E E. Roma and Poker  time limit per test           2 seconds memory limit per test     256 megabytes input standard input output standard output Each evening Roma plays online poker on his favourite websit…
803E - Roma and Poker 思路: 赢或输或者平的序列: 赢和平的差的绝对值不得超过k: 结束时差的绝对值必须为k: 当“?”时可以自己决定为什么状态: 输出最终序列或者NO: dp(随便搞搞): 来,上代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; ][],m; ]; int main…
[题目链接]:http://codeforces.com/contest/803/problem/E [题意] 给你一个不完整的胜负平序列(不完整是指中间有些地方为问号,让你自己选择胜负平) 让你复原一个有关胜.负.平.的结果序列 (从左到右按时间有序) 要求在前n-1秒; 胜负场数之差任意时刻都不能超过k; 且在第n秒,胜负场数值差刚好为k; [题解] 设f[i][j]表示前i场游戏,胜场与负场的差为j的情况能不能达到; 能达到就为true;并记录是怎么达到的(即是赢一场达到的还是输还是-)…
传送门 题意 Roma在玩一个游戏,一共玩了n局,赢则bourle+1,输则bourle-1,Roma将会在以下情况中退出 1.他赢了k个bourle 2.他输了k个bourle 现在给出一个字符串 'L':lose 'W':win '?':任意 'D':平局 输出一个字符串满足条件(Roma n局后离开要满足上述两个其中之一) 分析 dp题 令dp[i][j]表示进行i-1局比赛后,是否获得j个bourle. 如果第i局为'W': dp[i+1][j+1]=j; 如果第i局为'L':dp[i+…
题目链接:http://codeforces.com/problemset/problem/573/A 题目大意:此题要求一组数中的元素乘以2或者乘以3后得到的数都一样,其实就是判断这些数除去2和3这些因子后剩下的因子都是一样的即可. AC代码: #include <cstdio> #include <cmath> #include <cstring> #include <iostream> using namespace std; #define M 10…
题目链接:http://codeforces.com/problemset/problem/262/B 题目意思:给出 n 个数和恰好一共要做的操作总数k.通过对n个数进行k次操作,每次操作可以把a[i] 转化为 -a[i](当然也可以对同一个数进行 <= k次操作).问k次操作之后,整个序列的和最大为多少. 首先要知道整个序列中数的分布是如何的,有3种情况:1.都为正数.此时k次操作只需要考虑序列中第一个数,因为它是最小的.  2.都为负数.容易想到,要尽可能把最小的负数变为相应的正数,如果变…
Educational Codeforces Round 20  A. Maximal Binary Matrix 直接从上到下从左到右填,注意只剩一个要填的位置的情况 view code //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; fu…
A. Bear and Poker Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/573/problem/A Description Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Lima…
                                              C. Bear and Poker                                                                  time limit per test  2 seconds                                                                  memory limit per test  25…
Roma and Lucky Numbers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Roma (a popular Russian name that means 'Roman') loves the Little Lvov Elephant's lucky numbers. Let us remind you tha…