转自:http://blog.csdn.net/andrew_wx/article/details/6629913该例子为追加 C盘中的file1.txt的文本内容完整代码如下:引入命名空间:using System.IO; 完整代码:namespace FileStreamWrite { ...
1、设计思路现在主函数中输入二维数组,然后在用另一个函数通过四重循环(两重循环确定二维子数组第一个数字然后两重循环确定子数组有几行几列)来算出子数组和的最大值2、代码#includeusing namespace std;int Largest(int list[][100], int line,i...
分类:
编程语言 时间:
2015-04-13 12:31:35
阅读次数:
164
常见题了,分治思想,有一个结论划分后,将序列划分为更小的子集,继续应用该结论。图简单,直接递归了,之前看过非递归的写法。。。忘了Impl: 1 #include 2 #include 3 4 using namespace std; 5 6 void postOrder(string str...
分类:
其他好文 时间:
2015-04-13 12:26:41
阅读次数:
255
《C++编程艺术》上第二章的代码运行第一个测试程序的时候就报错了,上网找了下,没找到具体的解决方法,CSDN上有网友说是在collect里面出的错。好吧,我自己动手调进去修改吧。#include #include #include "gc.h" using namespace std; int .....
分类:
编程语言 时间:
2015-04-13 12:26:16
阅读次数:
136
#include
using namespace std;
struct Node
{
int data;
Node * next;
Node(int x=0):data(x),next(NULL){}
};
class List
{
public:
List()
{
first = new Node();
}
void Insert(int x)
{ ...
分类:
编程语言 时间:
2015-04-13 11:05:21
阅读次数:
151
http://poj.org/problem?id=2387
题目大意就是求最短路,从n到1的最短路。就用来熟悉一下spfa的写法。
一开始贡献了好几次wa,结果发现是因为n,m写反了。。。。
没有什么拐弯的地方,来熟悉spfa直接附上代码:
#include
#include
#include
#include
#include
using namespace std;
#de...
分类:
其他好文 时间:
2015-04-13 11:04:17
阅读次数:
148
刚开始一直WA,一直以为是自己往前延展的时候写错了,后来才发现是ST写错了
+-*/的优先级要比位运算优先级高,以后碰上不清楚优先级的运算一定要加括号
#include
#include
#include
#include
using namespace std;
#define N 100010
char s[N];
int r[N],wa[N],wb[N],wv[N],ws[N],sa...
分类:
其他好文 时间:
2015-04-13 10:59:50
阅读次数:
99
1、引言
对于自定义属性,大家肯定都不陌生,遵循以下几步,就可以实现:
自定义一个CustomView(extends View )类
编写values/attrs.xml,在其中编写styleable和item等标签元素
在布局文件中CustomView使用自定义的属性(注意namespace)
在CustomView的构造方法中通过TypedArray获取
ps:如果你对上...
分类:
移动开发 时间:
2015-04-13 10:56:44
阅读次数:
217
#include
#include
#include
using namespace std;
int num_of_st;
void getdata(vector & v, int n)
{
if (!v.empty())
throw runtime_error("v empty");
int t;
for (int i = 0; i > t...
分类:
编程语言 时间:
2015-04-13 09:43:23
阅读次数:
189
#include
#include
using namespace std;
typedef struct
{
int coef; //系数项
int exp; //指数项
}ElemType;
typedef struct Node
{
ElemType data;
struct Node *next;
}LNode,*LinkList;
void InitList(Lin...
分类:
其他好文 时间:
2015-04-13 09:35:43
阅读次数:
141