- 博客(91)
- 收藏
- 关注
原创 Android studio 踩坑指南
(跳坑指南持续更新)1. API23 之后引用httpclient等类会报错找不到此类,是官方隐藏了,给的解决方法是:build.gradle中加入配置: useLibrary 'org.apache.http.legacy'但有时候还是会报错:Unable to find optional library: org.apache.http.l
2016-04-12 11:50:42
697
原创 Android studio新建工程时报错:Gradle DSL method not found: 'android()'问题解决
Error:(16, 0) Gradle DSL method not found: 'android()'AS在创建项目的时候会自动查找项目设置的SDK版本,没有则会在AS项目下的build.gradle中添加android{...}的代码。解决办法:删除android{...}android studio 引进项目时,自动查找本机是否有项目设置的SDK版本,若发现没有,我们会在pr
2015-08-06 22:45:47
2634
原创 Android studio .9.png图片报错问题解决
直接拷贝 .9.png 格式的文件到Android studio工程中会报错. 后缀.9去掉后会无法实现拉伸,缩放等图片效果。解决办法:利用 Android studio中自带draw9patch 工具进行图片绘制. 路径在SDK的tools文件夹下,Mac中地址:教程传送门:http://blog.youkuaiyun.com/coder_pig/article/details/46963687
2015-07-21 23:45:30
8446
原创 hdu3061 Battle 最大流最小割
由于小白同学近期习武十分刻苦,很快被晋升为天策军的统帅。而他上任的第一天,就面对了一场极其困难的战斗:据侦查兵回报,前方共有N座城池,考虑到地势原因,最终得到一个结论:攻占某些城池之前必须攻占另外一些城池。事实上,可以把地图看做是一张拓扑图,而攻占某个城池,就意味着必须先攻占它的所有前驱结点。小白还做了一份调查,得到了攻占每个城池会对他的兵力产生多少消耗(当然也可能会得到增长,因为每攻
2014-03-15 15:13:06
580
原创 hdu 2586How far away ? 最近公共祖先LCA离线算法
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A to house B"? Usually it hard
2014-03-05 15:16:08
637
原创 Codeforces Round #223 (Div. 2) B 哈希表
题意:说得是一串数列。如果按照题目所示的排列。那么就是一个 stairsSequence a1, a2, ..., a|a| (|a| is the length of the sequence) is stairs if there is such index i (1 ≤ i ≤ |a|), that the following condition is met:a1
2014-01-13 17:40:48
758
原创 hdu1068 Girls and Boys 最大独立集
the second year of the university somebody started a study on the romantic relations between the students. The relation “romantically involved” is defined between one girl and one boy. For the study r
2013-12-30 13:36:11
751
原创 hdu1150 Machine Schedule 最小点覆盖
As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that
2013-12-29 20:48:41
596
转载 网络流基础篇——Edmond-Karp算法
BY纳米黑客 这是我的一个初学者教程系列的一部分,也是这个系列的第一篇文章,这个系列计划中将包括网络流,线段树,树状数组等一些初学者比较难以入门的内容。 因为是初学教程,所以我会尽量避免繁杂的数学公式和证明。也尽量给出了较为完整的代码。 本文的目标群体是网络流的初学者,尤其是看了各种NB的教程也没看懂怎么求最大流的小盆友们。本文的目的是,解释基本的网络流模型,最基础的最大流求法,即bf
2013-12-29 19:36:00
1397
原创 hdu1134 Game of Connections 卡特兰数(大数)
This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, ... , 2n - 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight
2013-12-29 16:06:53
729
原创 hdu1242 Rescue 优先队列BFS
Angel's friends want to save Angel. Their task is: approach Angel. We assume that "approach Angel" is to get to the position where Angel stays. When there's a guard in the grid, we must kill him (or h
2013-12-28 16:21:15
584
原创 hdu2899 Strange fuction 三分搜索
Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 Can you find the minimum value when x is between 0 and 100.题解:函数是凸性的,用二分搜索需要做特殊处理,求解凸性函数用三分搜索是比较方便的。类似二分的定义Left和Right,mid =
2013-12-27 20:49:24
600
原创 hdu1850 Being a Good Boy in Spring Festival 博弈 nim-sum定理
桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M);两人轮流进行;每走一步可以任意选择一堆并取走其中的任意张牌;桌子上的扑克全部取光,则游戏结束;最后一次取牌的人为胜者。现在我们不想研究到底先手为胜还是为负,我只想问大家:——“先手的人如果想赢,第一步有几种选择呢?”题解:先看nim-sum定理: 当nim游戏的某个位置:(x1,x2,x3),当且仅当其各部分的nim-
2013-12-27 18:49:01
770
原创 hdu1398 Square Coins 母函数
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-cre
2013-12-25 15:50:22
631
原创 hdu1050 Moving Tables BIT树状数组
The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of tables between rooms. Becau
2013-12-22 20:31:05
689
转载 STL Map详解
文章出处:http://blog.youkuaiyun.com/q3498233/article/details/4400992关于STL中map的用法剖析【完整版】1 map概述 STL(Standard Template Library 标准模版库)是C++标准程序库的核心,它深刻影响了标准程序库的整体结构。STL是一个范型(generic)程序库,提供一系列软件
2013-12-14 21:24:37
654
原创 hdu1159 Common Subsequence DP
题解:最长公共子串。题意就不说了。为何 a[0]='#',b[0]='# 不加就不过呢- -。。' 为何。#include#include#include#include#include#include using namespace std;#define LL long long#define maxn 100003char a[1005],b[1005];int d
2013-12-13 21:13:21
480
原创 hdu1205 吃糖果 鸽巢原理
题解:此题鸽巢原理证明出自:http://blog.youkuaiyun.com/hnust_xiehonghao/article/details/8005832鸽巢原理1.把某种糖果看做隔板,如果某种糖果有n个,那么就有n+1块区域,至少需要n-1块其他种糖果才能使得所有隔板不挨在一块..也就是说能吃完这种糖果.至少需要其他种类糖果n-1块..(鸽巢原理)2.数量最多的糖
2013-12-07 18:17:59
711
原创 hdu1800 Flying to the Mars ELFHash/BKDHash
we assume that one soldier has one level number indicating his degree. The soldier who has a higher level could teach the lower , that is to say the former’s level > the latter’s . But the lower can’t
2013-12-05 16:28:50
685
原创 hdu1496 Equations Hash
Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0.It is consider a solution a system (
2013-12-03 16:49:26
642
原创 codeforces 369C Valera and Elections DFS
The city Valera lives in is going to hold elections to the city Parliament.The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to a
2013-11-30 17:07:32
766
原创 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet /B. Petya and Staircases
A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the ri
2013-11-15 17:18:29
1343
原创 Codeforces Round #122 (Div. 2) B. Square
There is a square painted on a piece of paper, the square's side equals n meters. John Doe draws crosses on the square's perimeter. John paints the first cross in the lower left corner of the square
2013-11-10 20:41:23
654
原创 hdu4432 Sum of divisors
题目:mmm is learning division, she's so proud of herself that she can figure out the sum of all the divisors of numbers no larger than 100 within one day!But her teacher said "What if I ask you to giv
2013-11-01 17:20:17
724
原创 第九届湖南省大学生程序设计竞赛H题 高桥,低桥(UVA 12663) BIT 树状数组
There are one high bridge and one low bridge across the river. The river has flooded twice, why the high bridge is flooded twice but the low bridge is flooded only once?A: Because the lower bridge i
2013-10-22 11:58:07
1318
原创 vijos1514 天才的记忆 线段树
题解:题目意思很明确,就是查询串的区间最值,利用线段树可以便捷的解出。要注意的是在query查询的时候,初始值ret最好是设为大负数比如-(1#include#include#include#include#include#define maxn 200002#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using name
2013-10-08 21:42:55
677
原创 poj3061 Subsequence 尺取法
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the s
2013-10-03 20:04:19
663
原创 Uva 10006 Carmichael Numbers 快速幂
An important topic nowadays in computer science is cryptography. Some people even think that cryptography is the only important field in computer science, and that life would not matter at all without
2013-09-29 17:11:30
557
原创 NYOJ323 Drainage Ditches 最大流
Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus,
2013-09-11 11:01:01
504
原创 hdu4707 Pet 2013 ACM/ICPC Asia Regional Online —— Warmup
One day, Lin Ji wake up in the morning and found that his pethamster escaped. He searched in the room but didn’t find the hamster. He tried to use some cheese to trap the hamster. He put the cheese tr
2013-09-08 17:14:11
970
原创 poj3041 Asteroids 二分图最小点集覆盖
Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are conveniently loca
2013-09-08 16:45:30
535
原创 NYOJ239 月老的难题 二分图最大匹配(前向星)
题意:月老准备给n个女孩与n个男孩牵红线,成就一对对美好的姻缘。现在,由于一些原因,部分男孩与女孩可能结成幸福的一家,部分可能不会结成幸福的家庭。现在已知哪些男孩与哪些女孩如果结婚的话,可以结成幸福的家庭,月老准备促成尽可能多的幸福家庭,请你帮他找出最多可能促成的幸福家庭数量吧。假设男孩们分别编号为1~n,女孩们也分别编号为1~n。题解:根据描述可以看出这是个求
2013-09-07 17:35:15
621
原创 poj2431 Expedition 优先队列
group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run over a rock and puncture the truck's fuel tank. The
2013-09-07 16:15:32
939
原创 poj3009 Curling 2.0 DFS搜索
On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is ma
2013-09-05 21:28:02
539
原创 poj3176 Cow Bowling DP
The cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this: ……题意:给你一个非负整数组成的数字三
2013-09-04 12:06:56
688
原创 NYOJ 127 星际之门(一) N阶完全图的生成树数量
题解:ayley公式是说,一个完全图K_n有n^(n-2)棵生成树,换句话说n个节点的带标号的无根树有n^(n-2)个。那么此题就容易解了。证明见链接:http://blog.himdd.com/archives/979#include#include#include#includeusing namespace std;int main(){ int T,n,s;
2013-09-04 11:23:18
2492
原创 poj3617 Best Cow Line 贪心
FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.The contest or
2013-09-03 17:06:58
707
原创 poj2386 Lake Counting DFS
Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water
2013-09-03 15:47:22
552
原创 poj1852 Ants 穷竭搜索
An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it immediatelly falls off it. When two ants meet they t
2013-09-02 18:00:06
690
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人