题目链接:http://codeforces.com/problemset/problem/336/A 好简单的一条数学题,是8月9日的.比赛中没有做出来,今天看,从pupil变成Newbie了,那个伤心啊----不是分数的缘故,而是心态!!!昨晚一直卡机,网页很久才打得开,35min才进入比赛页面,接着做的时候又非常浮躁,静不下心来,提交时再次卡机,临20多min才提交成功,于是罢想!!心态真不好!!!这是第一次做题做得那么糟糕,要端正心态才行,遇到什么紧急情况都要冷静,保持清醒的头脑. 题意…
题目链接:http://codeforces.com/problemset/problem/336/C 题目意思:给出一个递增的正整数序列 a1, a2, ..., an,要求从中选出一堆数b1, b2, ..., bk,这堆数进行完按位&运算之后(b1 and b2 and ... and bk),能被2v整除.除此,还要求所选中的这堆数是两两不同的,&之后要最大,换句话来说,v 要尽可能最大,如果找到最大的v的方法有多种,即在 a1, a2, ..., an 中有很多种不同的组合 &a…
[LeetCode]120. Triangle 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址https://leetcode.com/problems/triangle/description/ 题目描述: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjac…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Vasily the Bear and Beautiful Strings Vasily the Bear loves beautiful strings. String s is beautiful if it meets the following criteria: String s only consists of characters 0 and 1, at that…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Vasily the Bear and Sequence Vasily the bear has got a sequence of positive integers a1, a2, ..., an. Vasily the Bear wants to write out several numbers on a piece of paper so that the beauty…
水题,注意数据范围即可 #include <iostream> #include <algorithm> #include <utility> using namespace std; typedef pair<int,int> Point; int main(){ int x,y; cin >> x >>y; Point a,b; if((x>0 && y > 0) || (x < 0 &&…
题目链接:http://codeforces.com/problemset/problem/385/B 题目意思:给定一条只有小写英文组成的序列,需要找出至少包含一个“bear”的单词的子序列个数.注意,子序列的下标编号是连续的,也就是sisi + 1... sj ,不是这种sisk... sj .(k!=i+1) 我的做法是每找到一个“bear”就计算出它的组合数,累加所有找到的“bear ”组合数即为答案.假设序列长度为len,先用string中的substr()来找出单词“bear”中“b…
http://codeforces.com/contest/336/problem/A #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int main() { int x,y; scanf("%d%d",&x,&y); &&y>=) { printf(,y+x,y+x,); } &&y&…
Content 一个矩形的顶点为 \((0,0)\),其对顶点为 \((x,y)\),现过 \((x,y)\) 作直线,分别交 \(x\) 轴和 \(y\) 轴于 \(A,B\) 两点,使得 \(\triangle OAB\) 为一个等腰直角三角形,求 \(A,B\) 点的坐标.(输出时 \(x\) 坐标小的先输出) 数据范围:\(-10^9\leqslant x,y\leqslant 10^9,x,y\neq 0\). Solution 这题是个数学题目,需要用到分类讨论. 这里先把草图给放上…
题意: 给出n,m,g,求好串的个数 0 <= n,m <= 10^5,n + m >= 1,0 <= g <= 1 好串的定义: 1.只由0,1组成,并且恰好有n个0,m个1 2.串的value = g 串的value的计算方式: 每次将最后2个字符替换,直至串的长度为1,该字符就是串的value 00 -> 1,   01,11,10 -> 0 solution: 首先,总方案数 = C(n + m, m) m = 0时,特殊判断 设f(n,m)为n个0,m个…