open函数调用open函数可以打开或创建一个文件#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>intopen(constchar*pathname,intflags);intopen(constchar*pathname,intflags,mode_tmode);pathname参数是要打开或创建的文件名,和fopen一样,pathn..
分类:
其他好文 时间:
2015-07-20 17:05:24
阅读次数:
125
//从键盘输入一个目录文件名;//打印.c文件,判断大括号是否成对出现;#include<stdio.h>
intmain()
{
FILE*Rfile=NULL;
char *Pput=NULL;
charname[100]="0";
intcount=5;
charch=‘0‘;
flag:
printf("请输入你要读取的文件目录与名字(eg:c:\\windows\\tes..
分类:
其他好文 时间:
2015-07-20 17:01:02
阅读次数:
98
#include<stdio.h>intmain(){ intch=0;intflag=1; intline=1; while(EOF!=(ch=getchar())){if(flag) { printf("%d",line); flag=0; }putchar(ch);if(ch==‘\n‘) { flag=1; line++; } }return0;}
分类:
其他好文 时间:
2015-07-20 17:00:26
阅读次数:
100
这道题当时没有写题解,这算是一个水dp吧
就给你一个2*n的格子,然后不能取相邻的边的邮票
那么当前的转台只能从自己的前面的左上角和左上角的左面一个格子推出来,最后求第一行和第二行得到的最大值#include
#include
#include
using namespace std;int dp[2][111111];
int a[...
分类:
其他好文 时间:
2015-07-20 16:43:55
阅读次数:
98
STL中与堆相关的4个函数——建立堆make_heap(),在堆中添加数据push_heap(),在堆中删除数据pop_heap()和堆排序sort_heap():
头文件 #include
下面的_First与_Last为可以随机访问的迭代器(指针),_Comp为比较函数(仿函数),其规则——如果函数的第一个参数小于第二个参数应返回true,否则返回false。
建立堆
make_heap(_First, _Last, _Comp)
默认是建立最大堆的。对int类型,可...
分类:
其他好文 时间:
2015-07-20 16:43:31
阅读次数:
117
代码:
// linkstack.hpp
// 栈类
#pragma once
#include "linklist.hpp"
template
class LinkStack
{
public:
LinkStack();
~LinkStack();
public:
int clear();
int push(T &t);
int pop(T &t);
int top(T &...
分类:
其他好文 时间:
2015-07-20 16:42:58
阅读次数:
95
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int n;
vector vec[100];
int vis[100];
struct node{
int n;
int t;
bool operator < (const node& a)con...
分类:
编程语言 时间:
2015-07-20 16:42:50
阅读次数:
463
题意:
给出一幅n个点m条边的连通图 求图中有几个点双连通分量
并输出每条边所在点双连通分量中所有边的编号最小边的编号
代码:
#include
#include
#include
#define maxn 20050
#define maxm 200050
using namespace std;
struct node{
int id,t...
分类:
其他好文 时间:
2015-07-20 16:37:29
阅读次数:
117
1. 指向指针的引用
#include
#include
using namespace std;
// int *&lhs 的定义应该从右向左理解:
// lhs 是一个引用,与指向 int 的指针相关联。
// 也就是说,lhs 是传递进 ptrswap 函数的指针的别名。
// 注意:不能这样定义:int &*lhs,编译报错提示为:cant declare pointer to “i...
分类:
其他好文 时间:
2015-07-20 16:36:50
阅读次数:
91
给出N个点,M条边,Q次询问
Q次询问每两点之间的最短距离
典型LCA 问题 Marjan算法解
#include "stdio.h"
#include "string.h"
struct Edge
{
int to,next,len;
}edge[20010];
struct Ques
{
int to,next,index;
}ques[2000010];...
分类:
编程语言 时间:
2015-07-20 16:35:14
阅读次数:
106