CF336A Vasily the Bear and Triangle 题解】的更多相关文章

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 这题是个数学题目,需要用到分类讨论. 这里先把草图给放上…
水题,注意数据范围即可 #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/336/A 好简单的一条数学题,是8月9日的.比赛中没有做出来,今天看,从pupil变成Newbie了,那个伤心啊----不是分数的缘故,而是心态!!!昨晚一直卡机,网页很久才打得开,35min才进入比赛页面,接着做的时候又非常浮躁,静不下心来,提交时再次卡机,临20多min才提交成功,于是罢想!!心态真不好!!!这是第一次做题做得那么糟糕,要端正心态才行,遇到什么紧急情况都要冷静,保持清醒的头脑. 题意…
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&…
转载请注明出处: 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…
C. Vasily the Bear and Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasily the bear has got a sequence of positive integers a1, a2, ..., *a**n*. Vasily the Bear wants to write o…
ZOJ 4081 Little Sub and Pascal's Triangle 题解 题意 求杨辉三角第n行(从1开始计数)有几个奇数. 考察的其实是杨辉--帕斯卡三角的性质,或者说Gould's sequence的知识. 其实网上很多题解都给出了答案,但大多数都只是给了一个结论或者说找规律(虽然我也是选择打表找规律先做的),但是思考为什么的时候我百度了一下,在wiki看了一些东西. wiki Pascal's triangle(https://en.wikipedia.org/wiki/P…
这场CF,脑子乱死啊...C题,搞了很长时间,结束了,才想到怎么做.B题,没看,D题,今天看了一下,很不错的组合题. 如果n和m都挺多的时候 以下情况都是变为1,根据偶数个0,最后将会为1,奇数个0,最后变为0,以1开头,全都是0. 0 1.. 0 0 0 1.... 0 0 0 0 0 1.... 总的情况是C(n+m,m),算1也可以算出来.注意m = 1的时候特判,0的时候,我也全写的特判. 10^5的组合数,用费马小定理求逆元.看了下题解,题解直接来了个逆元.. inv(a) = a^(…
Let's consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in the third line, etc. Develop a program which will compute the largest of the sums of numbers that appear on the paths st…