1.如何向接受结构参数的函数传入常量值?
c99标准中引入“复合字面量”(compound literals),它的一种形式就可以允许结构常量。例如,向假定的plotpoint函数
传入一个坐标对常量。
plotpoint((struct point){1,2});与制定初始式结合,也可以用成员名称确定成员值:
plotpoint((struct point){.x=1, .y=2});
...
分类:
编程语言 时间:
2014-07-22 23:04:35
阅读次数:
363
在第一部分我们介绍了编辑模式,但是编辑模式有较大局限性,下面我们主要开始介绍开发模式,这一部门先简单介绍下开发模式的环境搭建和关键词回复。
开发模式首先要有一个虚拟主机,本人使用的是新浪开发者平台的虚拟主机,使用云豆计算流量,若成为新浪开发者用户基本上就可以免费使用了,本人注册用户所赠送的云豆不知道能用多久。当然国内比较大就是百度开发者平台,注册后发现部署还没有新浪的方便,并且在BAE3.0以后...
分类:
微信 时间:
2014-07-22 23:01:53
阅读次数:
556
Little Vasya has received a young builder’s kit. The kit consists of several wooden bars, the lengths of all of them are known. The bars can be put one on the top of the other if their lengths are the...
分类:
其他好文 时间:
2014-07-22 23:01:53
阅读次数:
323
Fire station
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1308 Accepted Submission(s): 434
Problem Description
A city's map can ...
分类:
其他好文 时间:
2014-07-22 23:01:35
阅读次数:
287
思维好重要。。
对于n+m == k , 当n == m || abs(n-m) == 1 时n*m取得最大值。
则对于k分解成若干个数,则最后有若干个3和若干个2。
又有,三个2换成两个3,和不变积增大。所以最后最多之会有两个2,剩下的由3组成。
则题目变成了 求3^m。
#include
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-07-22 23:01:35
阅读次数:
282
原题链接: http://oj.leetcode.com/problems/4sum/
这道题要求跟3Sum差不多,只是需求扩展到四个的数字的和了。我们还是可以按照3Sum中的解法,只是在外面套一层循环,相当于求n次3Sum。我们知道3Sum的时间复杂度是O(n^2),所以如果这样解的总时间复杂度是O(n^3)。代码如下:public ArrayList> fourSum(int[] num,...
分类:
其他好文 时间:
2014-07-22 23:01:34
阅读次数:
328
精简Linux的文件路径:
..回退的功能.留在当前目录//只保留一个/abc/..要返回.报错删除最后一个/
主要思路: 用栈记录路径的起始位置,讨论/后的不同情况即可:
#include
#include
#include
#include
#include
#include
using namespace std;
int selectK(int num[]...
分类:
系统相关 时间:
2014-07-22 23:01:32
阅读次数:
384
在AWS里用Elastic Map Reduce 开一个Cluster然后登陆master node并编译以下程序:import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
...
分类:
其他好文 时间:
2014-07-22 23:01:32
阅读次数:
405
[ 问题: ]
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were
inserted in order. You may assume no duplicates in th...
分类:
其他好文 时间:
2014-07-22 23:01:15
阅读次数:
270