码迷,mamicode.com
首页 > 其他好文
【BZOJ 3028】 食物
生成函数(手写过程)~...
分类:其他好文   时间:2015-04-11 18:04:11    阅读次数:157
BZOJ 2701&&BZOJ 1319 Discrete Roots 数论
题目大意:求方程xk≡a(mod p)x^k≡a(mod\ p)在[0,p)[0,p)区间内的全部解 取pp的一个原根gg,两侧取指标得到: k?indgx≡indga(mod p?1)k*ind_gx≡ind_ga(mod\ p-1) 上EXGCD即可 注意a=0a=0要特判 (EXGCD已死系列……#include #include #include...
分类:其他好文   时间:2015-04-11 18:01:57    阅读次数:142
Leetcode6: Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of convertin...
分类:其他好文   时间:2015-04-11 18:02:02    阅读次数:123
例题7-12 旋转游戏 UVa1343
1.题目描述:点击打开链接 2.解题思路:本题利用迭代加深搜索解决。好久没做这个专题了,感觉这种方法有点力不从心,不会寻找估价函数是硬伤。。。只好学一学别人的代码。 本题要求棋盘中间的8个方格都要是相同的数字。紫书上说是利用状态空间搜索解决,大致模板还是八数码问题的模板。但是写了半天最后WA了,感觉这道题用那个模板写出来会很复杂。最后看别人的代码,才发现大多都是利用迭代加深搜索解决的,代码量也...
分类:其他好文   时间:2015-04-11 18:01:30    阅读次数:161
二叉数的非递归遍历
二叉树是一种非常重要的数据结构,很多其它数据结构都是基于二叉树的基础演变而来的。对于二叉树,有前序、中序以及后序三种遍历方法。因为树的定义本身就是递归定义,因此采用递归的方法去实现树的三种遍历不仅容易理解而且代码很简洁。而对于树的遍历若采用...
分类:其他好文   时间:2015-04-11 18:00:39    阅读次数:169
Palindrome Partitioning II--LeetCode
题目: Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = "aab"...
分类:其他好文   时间:2015-04-11 18:01:45    阅读次数:137
Canvas之太阳系
太阳系 您的浏览器不支持 var cxt = document.getElementById('canvas').getContext('2d');//设置2d环境 //轨道 function drawTrack() { for (var i = 0; i < 8; i++) { ...
分类:其他好文   时间:2015-04-11 18:00:07    阅读次数:143
资源加载卸载与内存的关系
22 关于Resources.load和实例化与内存的关系: 1.加载,单纯的Resources.load后消耗的内存很低,可能只是基础的引用预载、当对象被实例化后才会占用大量内存,当实例化多个对象后和实例化一个相差不大,可能后边实例的对象引用了第一个。 2.卸载,单纯的把所有实例的obj给destroy后,内存不会释放,但是再次实例也不会耗内存,若Object b = Resources.L...
分类:其他好文   时间:2015-04-11 18:00:35    阅读次数:138
Leetcode (5) Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.简而言之,判断两棵二叉树是否相等,这里...
分类:其他好文   时间:2015-04-11 18:02:35    阅读次数:90
[LeetCode]House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house...
分类:其他好文   时间:2015-04-11 18:01:53    阅读次数:104
Leetcode (6) Remove Duplicates from Sorted Array
题目描述Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with...
分类:其他好文   时间:2015-04-11 18:02:04    阅读次数:100
hdu 2120 Ice_cream's world I
就是问有多少个圈,简单的并查集,没啥好说的,心塞不开心 #include using namespace std; int mapp[1000+5]; void s() { for(int i=0;i<1000+5;i++) mapp[i]=i; } int bfs(int x) { if(x!=mapp[x]) { mapp[x]=bfs(mapp[x]); } return m...
分类:其他好文   时间:2015-04-11 18:01:49    阅读次数:103
hdu 4737 二分或暴力
http://acm.hdu.edu.cn/showproblem.php?pid=4737 Problem Description There are n numbers in a array, as a0, a1 ... , an-1, and another number m. We define a function f(i, j) = ai|ai+1|ai+2| ... ...
分类:其他好文   时间:2015-04-11 17:59:31    阅读次数:195
hihocoder#1049 : 后序遍历
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 在参与过了美食节之后,小Hi和小Ho在别的地方又玩耍了一阵子,在这个过程中,小Ho得到了一个非常有意思的玩具——一棵由小球和木棍连接起来的二叉树! 小Ho对这棵二叉树爱不释手,于是给它的每一个节点都标记了一个标号——一个属于A..Z的大写字母,并且没有任意两个节点的标号是一样的。小Hi也...
分类:其他好文   时间:2015-04-11 18:00:42    阅读次数:114
执行setResult后的回调顺序
A ——> startActivityForResult ——> B ——>setResult 不执行finish 方法  A是在B执行了setResult方法还是B被finish后执行onActivityResult方法? A ——> startActivityForResult ——> B ——>setResult ——> finish 如果栈里面A和B中间还有activity  A将不会在...
分类:其他好文   时间:2015-04-11 17:58:21    阅读次数:191
Best Cow Line(POJ-3617)
经典的贪心算法。   贪心算法的特点是总是取最优解,最后得到的也是最优,这一点上与动归不同。动归和搜索都是多策略的,所以贪心的理解难度还是很小的。 #include #include #include #include #include #include #include using namespace std; int n,a; vector ans; int main() { sca...
分类:其他好文   时间:2015-04-11 17:58:45    阅读次数:113
RT-Thread 学习笔记(十二)--- 开启基于RTGUI的LCD显示功能(2)
软件环境:Win7,Keil MDK 4.72a, IAR EWARM 7.2, GCC 4.2,Python 2.7 ,SCons 2.3.2 硬件环境:Armfly STM32F103ZE-EK v3.0开发板 参考文章:RT-Thread编程指南 RT-Thread_1.2.0+lwip+rtgui0.8.0 移植心得 RT-Thread RTOS组件:RTGUI...
分类:其他好文   时间:2015-04-11 17:59:46    阅读次数:639
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!