Gym 100187B-A Lot of Joy】的更多相关文章

题意:给两个一样的只含有26个小写字母的字符串,然后两个分别做一下排列,问如果对应位置的字母相等那么就愉悦值就加一,问愉悦值的期望是多少? 题解:只考虑两个序列相对的位置,那么就相当于固定一个位置,另外一个序列做排列.对于一个字符,假设是a,然后a有Na个,那么a选第一个序列中a对应的位置,发生这个事件的概率为1*(n-1)!/n!,1是选那个位置,(n-1)!是其他的元素排列,n!是总的情况.(注意,不能因为a可以选多个点就乘上x,因为a不可能同时对应两个位置,所以对答案的贡献只有一次) 学习…
B. A Lot of Joy Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/A Description Two boys Gena and Petya wrote on two strips of paper the same string s that consisted of lowercase Latin letters. Then each boy took o…
Joy of Flight 题目连接: http://codeforces.com/gym/100531/attachments Description Jacob likes to play with his radio-controlled aircraft. The weather today is pretty windy and Jacob has to plan flight carefully. He has a weather forecast - the speed and d…
题意:你从开始坐标到末尾坐标,要经过 k 秒,然后给你每秒的风向,和飞机的最大速度,问能不能从开始到末尾. 析:首先这个风向是不确定的,所以我们先排除风向的影响,然后算出,静风是的最小速度,如果这都大于最大速度,肯定是不可能,如果可能, 再计算出每秒走的单位长度,然后再模拟整个过程. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <str…
题意:给一个字符串,将每个字符分开放进两个口袋,每次从两个口袋分别拿出一个字符,如果相同则开心,问开心的次数期望是多少. 分析:数学期望题,然而这是我最不拿手的...最后答案是每个字符在字符串出现的次数/字符串长度的和. #include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm&…
 Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…
Don't make a promise when you are in Joy. Don't reply when you are Sad.Don't take decisions when you are Angry.Think Twice.Act Wise. 当你喜悦时,不要轻易地承诺.当你悲伤时,不要轻易地回复.当你愤怒时,不要轻易做出决定.三思而后行,明智之法.…