首页 > 其他
黑马day04 画一个汉字的随机验证码的图片
下面的程序详细介绍了如何画一个随机验证码发送到客户端即浏览器进行显示: 1.画随机验证码的代码: package cn.itheima.response; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.imag...
分类:其他   时间:2015-06-18 09:44:17    收藏:0  评论:0  赞:0  阅读:126
Invert Binary Tree
Invert a binary tree. 4 / 2 7 / \ / 1 3 6 9 to 4 / 7 2 / \ / 9 6 3 1 Trivia: This problem was inspired by this original tweet by Max Howe...
分类:其他   时间:2015-06-18 09:44:07    收藏:0  评论:0  赞:0  阅读:155
leetcode——190 Reverse Bits(32位无符号二进制数的翻转)
解题思路: (1)将需要翻转的数n跟1进行“&”运算,取得最低位上的数, (2)左移到对应位置上,实现翻转。 (3)将翻转的结果加入到result中 (4)将n>>1右移一位,继续遍历...
分类:其他   时间:2015-06-18 09:43:47    收藏:0  评论:0  赞:0  阅读:244
黑马day04 定时刷新&是否缓冲
定时刷新: //每隔一秒刷新 response.setIntHeader("Refresh", 1); response.setContentType("text/html;charset=utf-8"); response.getWriter().write("当前的时间"+new Date()); 告知浏览器不缓存数据。当使用验证码的时候就不缓存数据,为的是防止有的浏览...
分类:其他   时间:2015-06-18 09:43:29    收藏:0  评论:0  赞:0  阅读:207
LightOJ 1214(大数相除)
Large Division Description Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exi...
分类:其他   时间:2015-06-18 09:41:37    收藏:0  评论:0  赞:0  阅读:138
UVA 11827 Maximum GCD
求任意两个数的gcd最大值。 #include #include #include #include #include #include #include #define N 110 using namespace std; int n; int s[N]; int gcd(int b,int a) { return b==0?a:gcd(a%b,b); } int main() ...
分类:其他   时间:2015-06-18 09:41:27    收藏:0  评论:0  赞:0  阅读:350
UVA 10200 Prime Time
题意:给你两个数a,b,求[a,b]内有多少个数满足f(n)=n*n+n+41是素数。 题解:预处理除前缀和,直接求 #include #include #include #include #include #include #include #define N 10010 using namespace std; int n; int s[N]; bool ok(int x) {...
分类:其他   时间:2015-06-18 09:41:17    收藏:0  评论:0  赞:0  阅读:244
boost并发编程(三)——共享互斥量
前一篇介绍的条件变量可以进行进程间通信,用来实现生产者/消费者模型。今天介绍的共享互斥量用来实现缓冲区读写模型,与生产者/消费者模型不同的地方是,消费者消费产品后,被消费的产品就不存在了,所以消费者线程也要互斥运行;而缓冲区读取线程读取数据后不删除数据,多个线程可以并行读取。这时使用条件变量也不合适了,就要使用共享互斥变量了。         共享互斥量,顾名思义,既共享,也互斥,读线程之间共享...
分类:其他   时间:2015-06-18 09:39:07    收藏:0  评论:0  赞:0  阅读:186
HDU 2161Primes(判断是否是素数)
题意:给出一个数,不是很大的数,问是否是素数 思路:暴力法即可。...
分类:其他   时间:2015-06-18 09:38:57    收藏:0  评论:0  赞:0  阅读:357
LightOJ 1422 Halloween Costumes 【区间DP】
题目链接:http://lightoj.com/volume_showproblem.php?problem=1422解法:dp[i][j]=min(1+dp[i+1][j],dp[i+1][k-1]+dp[k][j]) 代码:#include #include #include #include #include <co...
分类:其他   时间:2015-06-18 09:38:27    收藏:0  评论:0  赞:0  阅读:220
(12)策略模式
?? 定义:定义一组算法,将每个算法都封装起来,并且使他们之间可以互换。 类型:行为类模式 类图: 策略模式是对算法的封装,把一系列的算法分别封装到对应的类中,并且这些类实现相同的接口,相互之间可以替换。在行为类模式中,有一种模式也是关注对算法的封装——模版方法模式,对照类图可以看到,策略模式与模版方法模式的区别仅仅是多了一个单独的封装类Context,它与...
分类:其他   时间:2015-06-18 09:37:47    收藏:0  评论:0  赞:0  阅读:213
(13)适配器模式
定义:(将一个类的接口变换成客户端所期待的另一种接口,从而使原本因接口不匹配而无法在一起工作的两个类能够在一起工作 类型:结构类型模式 类图: 类的适配器模式(采用继承实现) 对象适配器模式(采用对象组合方式实现) 代码实现: 类的适配器模式 // 已存在的、具有特殊功能、但不符合我们既有的标准接口的类 class Adaptee { public...
分类:其他   时间:2015-06-18 09:37:37    收藏:0  评论:0  赞:0  阅读:181
(14)迭代器模式
(14)迭代器模式 定义:提供一种方法访问一个容器对象中各个元素,而又不暴露该对象的内部细节。 类型:行为类模式 类图: 如果要问java中使用最多的一种模式,答案不是单例模式,也不是工厂模式,更不是策略模式,而是迭代器模式,先来看一段代码吧: public static void print(Collection coll){ Iterator it = coll....
分类:其他   时间:2015-06-18 09:37:27    收藏:0  评论:0  赞:0  阅读:268
leetCode(7):Copy list with random pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. /** * Definition for singly-l...
分类:其他   时间:2015-06-18 09:36:56    收藏:0  评论:0  赞:0  阅读:181
leetCode(8):merge two sorted list
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. /**  * Definition for singly-linked list.  * struct L...
分类:其他   时间:2015-06-18 09:36:07    收藏:0  评论:0  赞:0  阅读:229
leetCode(9):Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the...
分类:其他   时间:2015-06-18 09:35:57    收藏:0  评论:0  赞:0  阅读:201
Bmob失物招领教程即源代码
最近在学习Bmob,感觉功能挺强大的,分享一下!!! 效果图: 源代码地址:http://download.csdn.net/detail/gxseveryday/8817749 失物招领的简单案例,实现物品的发布、修改、呈现和删除,展示如何使用Bmob快速开发一个有后端数据库的应用软件。使用场景如下:用户捡到物品,打开手机软件,填写物品的招领信息(标题、描述和联系方...
分类:其他   时间:2015-06-18 09:35:08    收藏:0  评论:0  赞:0  阅读:512
easyUI datagrid 查询方法
1,公共函数,表单数据转JSON //将表单数据转为jsonfunction form2Json(id) { var arr = $("#" + id).serializeArray() var jsonStr = ""; jsonStr += '{'; for (var i = 0; i arr.length; i++) { jsonStr +=...
分类:其他   时间:2015-06-18 09:33:27    收藏:0  评论:0  赞:0  阅读:330
括号配对问题
描述现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0#include#define P printf#define S scanfmain(){ int i,j,k,n ,m,f; char s[10000]; S("%d",&f);getchar(); whi...
分类:其他   时间:2015-06-18 09:30:47    收藏:0  评论:0  赞:0  阅读:173
HDU 3065 病毒侵袭持续中(AC自动机)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3065题意:有n个模式串,一个主串,求每个模式串在主串中出现的次数思路:AC自动机水题,trie树中也要维护标号,再开一个num数组记录出现次数即可,扫描匹配时注意跳转fail指针和root节点。code...
分类:其他   时间:2015-06-18 09:30:07    收藏:0  评论:0  赞:0  阅读:199
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!