A - Vasya and Football
纯模拟。。比较坑的是会有不符合足球常识的地方。。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define LL ...
分类:
其他好文 时间:
2014-12-04 21:39:17
阅读次数:
290
Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should...
分类:
其他好文 时间:
2014-12-04 19:57:46
阅读次数:
204
昨天这场CF打的还挺爽的,不过就是没咋涨Rating,没把握好涨Rating的机会。。
本来可以过四题的,,但是很失败,重评后跪了两道。。唉:-(
A. Vasya and Football
思路:给每个人计数,黄牌+1,红牌+2。
当数字第一次超过2时输出。
题目链接:A. Vasya and Football
AC代码:
#include
#...
分类:
其他好文 时间:
2014-12-04 18:01:19
阅读次数:
187
Binary Tree Inorder TraversalGiven a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3...
分类:
其他好文 时间:
2014-12-04 00:52:08
阅读次数:
191
Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 ...
分类:
其他好文 时间:
2014-12-03 23:14:20
阅读次数:
163
isSameTree1Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally i...
分类:
其他好文 时间:
2014-12-03 23:11:24
阅读次数:
367
Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers s...
分类:
其他好文 时间:
2014-12-03 23:05:22
阅读次数:
328
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:
其他好文 时间:
2014-12-03 23:00:53
阅读次数:
290
不知道到底是我的水平提高了还是CF的题目变水了。。。。。。
A - Vanya and Cubes
水题。。暴力枚举就可以。。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespa...
分类:
其他好文 时间:
2014-12-03 21:29:43
阅读次数:
165
直接不会,预估时间复杂度,对于C(n,m) 到规模为500就瞎了。当时也想算法应该接近常数级别的。
如果真的算必然跪。回头看了下解题报告。
话说比赛很喜欢考异或,“位”思想,组合问题
对于计算选取k个数字时候,分别计算各个位上可能出现的情况,然后计算各个位上的累加和。即便一个数字可由很多位组成但是每次计算一个位
记录每一位上1的个数(这里只需要32位),对于第i天,必须要选出奇数个1才能...
分类:
其他好文 时间:
2014-12-03 21:22:16
阅读次数:
172