A. Borya and Hanabi Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/442/problem/A Description Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Ove…
A. Borya and Hanabi time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the…
layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces - 模拟栈 - 贪心 传送门 A.Anton and Letters (签到) 题意 判断字符串里面有多少个不同字符 思路 直接set一下 #include<bits/stdc++.h> using namespace std; typed…
Codeforces Round #253 (Div. 1) 题目链接 A:给定一些牌,然后如今要提示一些牌的信息,要求提示最少,使得全部牌能够被分辨出来. 思路:一共2^10种情况,直接暴力枚举,然后对于每种情况去推断,推断的时候仅仅要两两张牌枚举出来推断就可以.不得不说CF机子真心强大,2秒限制还是能跑10^8 B:给定n个发生概率,求选出当中一些事件,使得正好有一件发生的概率最大. 思路:贪心,从大到小排序概率,然后一个个概率进来推断有没有更大,有就增加该事件,没有就跳过 C:给定n个数字…
Codeforces Round #297 (Div. 2)D. Arthur and Walls Time Limit: 2 Sec  Memory Limit: 512 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/525/problem/D Description Finally it is a day when Arthur has enough money for buying an apartment. H…
题目连接 题意: n表示有n个卡片.每一个卡片有一种颜色和一个数字(共五种不同的颜色和五个不同的数字). 事先知道每种卡片有几张.可是不知道详细的位置. 问须要几次提示就能够知道全部卡片的位置都在哪里:每次提示能够选择一个颜色或者一个数字.就能够知道含有所选属性的牌有哪些. 分析: 首先明确总情况数不多,仅仅有2^10,所以枚举. 能确定某张牌位置的情况:1)提示了一个属性,而这个属性仅仅有一张牌 2)某个属性有n张牌,知道了n-1张牌的位置 两个提示确定一张牌:必定的,仅仅要存在这张牌.那么两…
关于证明可以参考题解http://codeforces.com/blog/entry/12739 就是将概率从大到小排序然后,然后从大到小计算概率 #include <iostream> #include <vector> #include <string> #include <algorithm> #include <functional> #include <cstdio> using namespace std; int mai…
题目大意是选出一个其他不选,问问最大概率: 刚开始想到DP:F[I][J][0]:表示从 前I个中选出J个的最大值, 然后对于F[I][J][1]=MAX(F[I-1][J][1],F[I-1][J-1][0]*A[I]+F[I-1][J-1][1]*(1-A[I])); 但是这是错误的因为F[I-1][J-1][0]和F[I-1][J-1][1]不一定对应相同的数.//我错了,可以DP 先来公式:     double temp=f[i-1][j-1][0]*p[i]+f[i-1][j-1][…
本题要考虑字符串本身就存在tandem, 如测试用例 aaaaaaaaabbb 3 输出结果应该是8而不是6,因为字符串本身的tanderm时最长的 故要考虑字符串本身的最大的tanderm和添加k个字符后最大的tanderm #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> using namespace std…
题目很简单,只需要注意带空格的输入用getline即可 #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> using namespace std; int main(){ string str; getline(cin,str); set<char> a; ; i < str.length()-;…