暴搜一下就行了,确实也没法优化什么。 不过枚举一半,另一半用next_permutation()函数应该是会快一些的。
#include
#include
#include
#include
#include
#include
using namespace std;
int T,a[20],n,vis[20],tot;
int A[20],B;
void dfs(int cur) {
...
分类:
其他好文 时间:
2015-04-14 16:44:14
阅读次数:
141
观看几个程序片段,分析行为
1、
public static boolean fun(){
try{
return false;
}finally{
return true;
}
}
System.out.println(fun());
2、
public static boolean fun(){
try{
return false;
}fina...
分类:
其他好文 时间:
2015-04-14 16:43:54
阅读次数:
106
问题描述In the New Year 2014, Xiao Ming is thinking about the question: give two integers N and K, Calculate the number of the numbers of satisfy the following conditions:
It is a positive integer and is n...
分类:
其他好文 时间:
2015-04-14 16:42:31
阅读次数:
119
安装 git
sudo apt-get install git
查看git配置
git config --list
或者~/gedit .gitconfig
git设置代理(一般用于公司内部网络,如果上网正常,不需要设置)
git config --global http.proxy ip:port
git用户名
git config --global user.name ...
分类:
其他好文 时间:
2015-04-14 16:44:49
阅读次数:
178
第一步:更改配置文件
chuck@ubuntu:/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/initializers$ cp smtp_settings.rb.sample smtp_settings.rb
chuck@ubuntu:/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/initializ...
分类:
其他好文 时间:
2015-04-14 16:41:46
阅读次数:
123
通过上一篇文章,我们用ffmpeg分离出一个多媒体容器中的音视频数据,但是很可能这些数据是不能被正确解码的。为什么呢?因为在解码这些数据之前,需要对解码器做一些配置,典型的就是目前流行的高清编码“黄金搭档”组合H264 + AAC的搭配。本文将讲述H264和AAC的关键解码配置参数的解析,如果没有这些配置信息,数据帧往往不完整,导致了解码器不能解码。
H264的配置信息解析
前...
分类:
其他好文 时间:
2015-04-14 16:43:41
阅读次数:
227
Confaccess.h
#ifndef __CONFACCESS_H__
#define __CONFACCESS_H__
#include
#include
#include
#include
class CConfAccess
{
public:
static CConfAccess* getInstance()
{
...
分类:
其他好文 时间:
2015-04-14 16:42:03
阅读次数:
127
正则表达式是一种不确定有限自动机。NFA。
在书写正则表达式时应尽量减少回溯来提高正则表达式的效率。
一. 理解元字符
根据功能,元字符可分为两种类型:匹配位置的元字符和匹配字符的元字符。
1. 匹配位置的元字符
包括:^、$和\b三个字符。
^(脱字符号,在文章插入字时使用)
$(美元符号)。
他们分别表示行的开始和末尾。
^string 正则表达式匹配以str...
分类:
其他好文 时间:
2015-04-14 16:41:38
阅读次数:
141
程序(已经accepted):
#include
#include
#include
#define N 1000010
char str[N];
int next[N];
int get_next(char pattern[], int next[])
{
int j=0,k=-1;
int len=strlen(pattern);
next[0]=-1;...
分类:
其他好文 时间:
2015-04-14 16:42:45
阅读次数:
115
problem:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
Hide Tags
Array Hash
Table Stack Dynamic
Programmin...
分类:
其他好文 时间:
2015-04-14 16:40:04
阅读次数:
110
本文分析FFmpeg的H.264解码器的主干部分。“主干部分”是相对于“熵解码”、“宏块解码”、“环路滤波”这些细节部分而言的。它包含了H.264解码器直到decode_slice()前面的函数调用关系(decode_slice()后面就是H.264解码器的细节部分,主要包含了“熵解码”、“宏块解码”、“环路滤波”3个部分)。...
分类:
其他好文 时间:
2015-04-14 16:42:14
阅读次数:
429
在启动WCF服务时,报错:
“net.tcp://localhost:8080/tcpTest”处带有协定“"ITestService"”的 ChannelDispatcher 无法打开其 IchannelListener。
在查看详细异常信息时:找到InnerException异常信息中,发现:
{"未提供服务证书。请在 ServiceCredentials 中指定服务证书。"}
...
分类:
其他好文 时间:
2015-04-14 16:41:03
阅读次数:
302
rand7生成7个整数,没有办法均匀的映射成10个整数,但是运行两次rand7可以生成49个数字,如果这49个数字是均匀分布的,舍去多余的9个,剩下的40个正好可以用模10运算映射到10个整数上。
代码1
view plain
int i;
do
{
i = 7 * (rand7() - 1) + rand7(); // it is...
分类:
其他好文 时间:
2015-04-14 16:39:52
阅读次数:
133
一、准备工作
安装水经注万能地图下载器,如果没有安装本软件,可以百度“水经注软件”到官方网站下载。
编译OSG、OSGEarth和第三方插件等,这里有一个已经编译好的vs2010+osgearth,
下载地址“http://pan.baidu.com/share/link?shareid=107009&
uk=2801833827”。
二、下载地图
首先需要把谷歌卫星地图下载下来,这里...
分类:
其他好文 时间:
2015-04-14 16:40:20
阅读次数:
136
android开发中代码动画编写,和添加。...
分类:
其他好文 时间:
2015-04-14 16:40:34
阅读次数:
86
Problem Description:
There is a dice with n sides, which are numbered from 1,2,...,n and have the equal possibility to show up when one rolls a dice. Each side has an integer ai on it. Now here is a ...
分类:
其他好文 时间:
2015-04-14 16:38:23
阅读次数:
121
本来以为会超时,看来是想多了,63ms,看来对时间复杂度的判断能力还是不行啊。这个题正是next_permutation()函数的用武之地。
#include
#include
#include
#include
#include
#include
using namespace std;
int n,sum,a[100],A[100];
int main() {
scanf("%d%d...
分类:
其他好文 时间:
2015-04-14 16:37:55
阅读次数:
112