首页 > 2015年04月05日 > 全部分享
例题7-1 除法 UVa725
1.题目描述:点击打开链接 2.解题思路:本题利用暴力搜索解决。直接从1234开始枚举除数,由于乘积不能超过100000,所以上限是100000/n。然后判断得到的乘积和除数中的所有数是否都各不相同即可。 3.代码: #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #...
分类:其他   时间:2015-04-05 17:33:31    收藏:0  评论:0  赞:1  阅读:148
SPOJ - QTREE (树链剖分)
基础的树链剖分题目,不过是边权,可以向下映射成点权或者按边剖分。 VIEW CODE #include #include #include #include #include #include using namespace std; const int mmax=10010; const int inf=0x3fffffff; struct edge { int st,en,cos...
分类:其他   时间:2015-04-05 17:33:21    收藏:0  评论:0  赞:0  阅读:164
swing实现计算器
代码如下 import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Vector; public class Calculator { String str1 = "0"; // 运算数1 初值一定为0 为了程序的安全 String str2 = "0"; // 运算数...
分类:Windows开发   时间:2015-04-05 17:33:11    收藏:0  评论:0  赞:0  阅读:274
ZOJ3203--Light Bulb(三分法)
Compared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommodious house, t...
分类:其他   时间:2015-04-05 17:33:01    收藏:0  评论:0  赞:0  阅读:147
拓扑排序欢乐多
拓扑排序 拓扑排序 一:使用DFS实现二:使用入度概念以及队列处理1.使用一般队列2.使用优先队列(这里定义越大的整数拥有越大的优先级) 一:使用DFS实现 #include bits/stdc++.h>using namespace std;#define maxn 10000 + 10int c[maxn],topo[ma...
分类:编程语言   时间:2015-04-05 17:32:51    收藏:0  评论:0  赞:0  阅读:352
LeetCode Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.The first integer of each...
分类:其他   时间:2015-04-05 17:32:41    收藏:0  评论:0  赞:0  阅读:129
安卓流式布局
安卓流式布局,经常用在  历史搜索框、人物标签 等安卓功能中, 对于没有经验的同学来说,要自己写流式成册确实是一个难点,或者写出来的自定义布局的运行效率也不高,这里是我自己整理出的一个非常好的例子, 拿出来跟大家交流学习。 1、 FlowViewGroup 类的java代码如下 package com.snippet.worklearn; import android.conte...
分类:移动平台   时间:2015-04-05 17:32:31    收藏:0  评论:0  赞:0  阅读:329
c++模板元编程一:基本概念
1 基本概念1.1 meta program 元程序可以用meta program生成object program, 也可以object program作为数据看待,从而组装出更大的object program 元程序是处理程序的程序,如大家熟悉的编译器、解释器、类型检查器、定理证明器、程序生成器、转换系统和程序分析器等等1.2 object program 目标程序目标程序,又称为“目的程序”,...
分类:编程语言   时间:2015-04-05 17:32:21    收藏:0  评论:0  赞:0  阅读:304
例题7-2 最大乘积 UVa11059
1.题目描述:点击打开链接 2.解题思路:本题利用暴力搜索解决,由于n,S的范围都比较小,直接利用三重循环枚举。又最大可能乘积不会超过10^18,因此结果用long long保存。注意枚举的时候起点和终点可以重合。 3.代码: #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #incl...
分类:其他   时间:2015-04-05 17:32:11    收藏:0  评论:0  赞:0  阅读:262
Plus One -- leetcode
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. class Solution { p...
分类:其他   时间:2015-04-05 17:31:51    收藏:0  评论:0  赞:0  阅读:212
c++模板元编程二:用enum做数值计算
2.1 用enum做数值计算下面两篇文章都介绍了模板元编程,enum是其最重要的基本工具 http://www.codeproject.com/Articles/3743/A-gentle-introduction-to-Template-Metaprogramming https://www10.informatik.uni-erlangen.de/~pflaum/pflaum/ProSemin...
分类:编程语言   时间:2015-04-05 17:31:41    收藏:0  评论:0  赞:0  阅读:375
[LeetCode]Unique Paths
题意: https://leetcode.com/problems/unique-paths/ A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at a...
分类:其他   时间:2015-04-05 17:31:35    收藏:0  评论:0  赞:0  阅读:181
c++模板元编程三:循环展开
2.2 loop unrolling 循环展开前面enum一节介绍的是和template联合,引发编译器递归的奇妙作用。template本身无需enum配合也可以达到递归的效果。// test template recursive for loop unrolling cout << "test 2: template recursive for loop unrolling" << en...
分类:编程语言   时间:2015-04-05 17:31:21    收藏:0  评论:0  赞:0  阅读:433
Xcode个人常用快捷键
Xcode个人常用快捷键导航快捷键command+1-8:打开 Project/Symbol/Find/Issue/Test/Debug/Breakpoint/Log 导航栏command+0:显示/隐藏 左侧 tool paneloption+command+0:显示/隐藏 右侧 tool paneloption+command+1:显示 右侧 the file inspectoroption+c...
分类:其他   时间:2015-04-05 17:31:11    收藏:0  评论:0  赞:0  阅读:241
Listview的使用与优化(下)
接上一篇文章,首先我们再来复习一个listview的缓存优化方法 1,对Imageview使用setTag()方法来解决图片错位问题,这个Tag中设置的是图片的url,然后在加载的时候取得这个url和要加载那position中的url对比,如果不相同就加载,相同就是复用以前的就不加载了 2,对于要加载的图片资源,先在内存缓存中找(原始的方法是使用SoftRefrence,最新的方法是使用a...
分类:其他   时间:2015-04-05 17:31:01    收藏:0  评论:0  赞:0  阅读:269
ZSTU OJ 4189 逻辑运算(逆波兰式)
Description  还记得大学里学过的模电么,今天就让我们将与或非变成一道题吧。 给你一个与或非的表达式,求出这个表达式的值,表达式总共有八种字符。 三种逻辑运算符按照优先级排列如下。 ‘!’:表示取反。 ‘&’:逻辑与。 ‘|’:逻辑或。 两个字符‘T’,‘F‘分别表示true和 false。 另外还有左右括号,空格三种字符。跟一般的表达式一样,括号可以改变优先级。 ...
分类:其他   时间:2015-04-05 17:30:53    收藏:0  评论:0  赞:0  阅读:345
利用Lucene和 XPDF 来处理pdf文件
/*  * 利用Lucene和 XPDF 来处理pdf文件  * */ package pdfbox; import java.io.File; import java.io.IOException; public class Pdf2Test { //PDF文件名 private File pdffile; //转换器的存放位置,默认为E:\\xpdf下 ...
分类:Web开发   时间:2015-04-05 17:30:41    收藏:0  评论:0  赞:0  阅读:250
例题7-3 分数拆分 UVa10976
1.题目描述:点击打开链接 2.解题思路:根据题目描述,可以解出来y的范围是1≤y≤2k。进而可以求出x=ky/(y-n)。注意x要大于0且是整数。 3.代码: #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #i...
分类:其他   时间:2015-04-05 17:30:31    收藏:0  评论:0  赞:0  阅读:221
内存分析与内存泄漏检测
Android 查看所有进程内存占用情况 (1)连接设备,打开USE调试模式 (2)打开命令行,执行命令:adb shell procrank 字段说明: PID:进程id VSS(Virtual Set Size): 虚拟耗用内存(包含共享库占用的内存) RSS(Resident Set Size):实际使用物理内存(包含共享库占用的内存) PSS(Proportional Set Size): 实际使用的物理内存(比例分配共享库占用的内存) USS(Unique Set Size): 进程独自...
分类:其他   时间:2015-04-05 17:30:21    收藏:0  评论:0  赞:0  阅读:250
c++模板元编程四:IF语句编译时运行
2.3 if 替代将if语句放在编译期执行,可以用模板特化的方式实现。下面是调用代码:// test if cout << "test if" << endl; If::Run(); 输出结果为:test if it's false 模板类的实现如下:template class If { public: static inline void Run() { cout << "it's...
分类:编程语言   时间:2015-04-05 17:30:11    收藏:0  评论:0  赞:0  阅读:177
1322条   上一页 1 ... 23 24 25 26 27 ... 67 下一页
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!