http_build_query生成 url-encoded 之后的请求字符串 1、使用键值对,关联数组: <?php $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); e ...
分类:
Web程序 时间:
2017-06-01 12:02:06
阅读次数:
144
看到Palindrome的题目。首先想到的应该是中心问题,然后从中心出发,思考怎样解决。 DP问题通常是从更加小的问题转化到更加大的问题。然后是从地往上 bottom up地计算答案的。 能得出状态转移方程就好办了,本题的状态转移方程是: if (cowID[i] == cow{j]) tbl[id ...
分类:
其他好文 时间:
2017-05-30 22:01:28
阅读次数:
152
内部类意义: 更好的封装:比如cow类,内部定义一个cowleg类,cowleg类只有在cow类里才有意义,不允许其他类访问cowleg类 内部类成员可以直接访问外部类的私有数据,但外部类不能访问内部类细节,如成员变量 匿名内部类适合创建仅需要使用一次的类 内部类比外部类多三个修饰符,private ...
分类:
其他好文 时间:
2017-05-30 20:55:44
阅读次数:
155
题目:洛谷P2685、HDU2717 题目大意:有一个人在点$n$,一头牛在点$k$,人每秒能从$x$移动到点$x+1$、$x-1$、$2x$,牛不会动,求最少多少秒后人能移动到牛所在的$k$。 思路:BFS。按照题意进行广搜。 注意:题目数据较大,如中途计算中的点$x$大于100000或小于1,则 ...
分类:
其他好文 时间:
2017-05-30 20:53:32
阅读次数:
187
传送门 先按照起点 sort 一遍。 这样每一个点的只由前面的点决定。 f[i][j] 表示终点为 i,花费 j 的最优解 状态转移就是一个01背包。 ——代码 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #inc ...
分类:
其他好文 时间:
2017-05-30 19:31:54
阅读次数:
171
Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10659 Accepted: 5116 Description Few know that the cows have their own dictionary with W (1 ...
分类:
其他好文 时间:
2017-05-28 11:44:27
阅读次数:
189
P2946 [USACO09MAR]牛飞盘队Cow Frisbee Team 题目描述 After Farmer Don took up Frisbee, Farmer John wanted to join in the fun. He wants to form a Frisbee team f ...
分类:
其他好文 时间:
2017-05-27 15:17:51
阅读次数:
258
传送门 f[i] 表示前 i 个字符去掉多少个 的最优解 直接暴力DP ——代码 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 5 int n, m, cnt, f[301]; 6 char s[301], a[60 ...
分类:
其他好文 时间:
2017-05-26 10:59:33
阅读次数:
297
[USACO07DEC]最佳牛线,黄金Best Cow Line, Gold 题目描述 FJ is about to take his N (1 ≤ N ≤ 30,000) cows to the annual"Farmer of the Year" competition. In this con ...
分类:
其他好文 时间:
2017-05-26 00:51:30
阅读次数:
248
Description Farmer John recently bought another bookshelf for the cow library, but the shelf is getting filled up quite quickly, and now the only avai ...
分类:
其他好文 时间:
2017-05-25 21:54:10
阅读次数:
250