- 博客(124)
- 收藏
- 关注
原创 A Plug for UNIX(最大流)
题目链接点击这里 A Plug for UNIXTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16517 Accepte
2016-11-27 23:01:28 641
原创 Dining(最大流)
E. DiningTime Limit: 2000msMemory Limit: 65536KB64-bit integer IO format: %lld Java class name:Main SubmitStatus PID: 3400 Cows are such finicky eaters. Each cow has a p
2016-11-19 23:19:11 747
原创 简单车票管理系统案例
简单车票管理系统using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication1{ class Program { static vo
2016-10-19 00:26:10 1767
原创 简单的输入输出、一维数组、二维数组、普通遍历、使用foreach语句遍历数组操作
简单的输入输出、一维数组、二维数组、普通遍历操作using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication1{ class Program {
2016-10-18 23:03:59 4568
原创 Escape from Enemy Territory(二分+bfs)
Escape from Enemy TerritoryTime Limit: 5000msMemory Limit: 65536KB64-bit integer IO format: %I64d Java class name: MainA small group of commandos has infiltrated deep into enemy
2016-10-17 22:26:48 547
原创 KMP
KMP模板#include #include #include using namespace std;char T[1000], P[1000];int f[1000];void getf(){ int m = strlen(P); f[0] = 0, f[1] = 0; for(int i = 1; i < m; i++){ int
2016-10-04 22:21:30 323
原创 删除、拷贝、改文件名 三种操作(DeleteFile函数、CopyFile函数、MoveFile函数)
#include #include int main(int argc, PTCHAR argv[]){ //printf("个数 :%d\n", argc); //printf("参数1 :%s\n", argv[0]); //printf("参数2 :%s\n", argv[1]); //printf("参数3 :%s\n", argv[2]); if (lstrcmp("-
2016-10-03 17:36:35 6438
原创 文件操作的四种方法
第一种方法:C语言void CMFCApplication1Dlg::OnBnClickedButton1(){ // TODO: 在此添加控件通知处理程序代码 CString s = TEXT("*********************C*********************\r\n"); char line[256]; FILE *pFile = fopen("codes
2016-10-02 23:19:28 839
原创 磁盘容量(GetDiskFreeSpace函数和GetDiskFreeSpaceEx函数)
GetDiskFreeSpace函数和GetDiskFreeSpaceEx函数,主要是用来计算磁盘的各种容量,具体能计算什么,代码中注释得很详细#include #include using namespace std;int main(){ //得出磁盘的可用空间 DWORD dwTotalClusters;//总的簇 DWORD dwFreeClusters
2016-09-30 10:24:25 16211
原创 驱动器属性(GetDriveType函数 和 GetVolumeInformation函数)
点击我的电脑 --> 资源管理器 --> 每一个盘右击都有一些属性 (文件系统、配额、文件名的长度 等等)都可以用这两个API函数去获取#include #include #include BOOL GetDriveInfo(LPSTR szDrive){ UINT uDriveType; uDriveType = GetDriveType(szDrive); swit
2016-09-28 20:01:01 3683
原创 关于map
最基本的操作:插入(四种方法)、遍历(顺序和逆序)#include #include #include using namespace std;map mp;/* 插入的前三种方法的返回值是 pair*/void display(){ //插入的四种方法 //方法1 mp.insert(pair (1, "string01"));
2016-09-27 13:25:56 368
原创 遍历卷(GetLogicalDrivesStrings函数 、 FindFirstVolume函数 和 FindNextVolume函数)
此电脑 -> 管理 -> 磁盘管理 -> 每个盘是一个卷 -> 也可以叫做一个逻辑驱动器GetLogicalDriveStrings函数是将所有盘的名称都存在一个字符串中 每个盘以 \0 为分隔我们要写代码去判断何时结束读取#include #include #include #define BUFSIZE 1024int main(){ CH
2016-09-22 23:40:35 1701
原创 1007 The Best Path(无向图的欧拉路)
The Best PathTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 541 Accepted Submission(s): 220Problem DescriptionAlice is planning
2016-09-19 13:27:54 562
原创 1008 QSC and Master (区间dp)
QSC and MasterTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 176 Accepted Submission(s): 61Problem DescriptionEvery school has
2016-09-18 23:08:11 472
原创 1001 I Count Two Three(打表+二分 用lower_bound函数)
I Count Two ThreeTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 377 Accepted Submission(s): 204Problem DescriptionI will show yo
2016-09-17 23:45:14 511
原创 1002 Cure(打表)
CureTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 581 Accepted Submission(s): 206Problem DescriptionGiven an integer n, we on
2016-09-17 23:07:25 393
原创 lower_bound()返回值
函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于val的第一个元素位置。如果所有元素都小于val,则返回last的位置举例如下:一个数组number序列为:4,10,11,30,69,70,96,100.设要插入数字3,9,111.pos为要插入的位置的下标则pos = lower_bound( number, num
2016-09-17 22:03:38 457
原创 如何手动做Windows窗口
#include #include HINSTANCE hinst;LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
2016-09-02 14:51:32 892
原创 GetSystemDirectory函数 和 WriteFile函数(加 CreateFile函数——始终创建型)
GetSystemDirectory函数功能:得到系统目录的文件夹#include #include int main(){ TCHAR SystemDirectory[MAX_PATH]; GetSystemDirectory(SystemDirectory, MAX_PATH); printf("%s\n", SystemDirectory); system("pa
2016-09-01 11:48:57 847
原创 Windows数据结构(Win32_FILE_ATTRIBUTE_DATA结构 —— GetFileAttributesEx函数案例)
和以上类似的数据结构,在Windows里数不胜数#include #include VOID ShowFileTime(FILETIME lptime){ FILETIME ftLocal;//保存第一次转换后的本地时间 SYSTEMTIME st;//保存第二次转换后的系统时间 //第一次转换 :将 世界文件时间 转换成 本地文件时间 FileTimeToLocalFileT
2016-09-01 10:20:45 5471 2
原创 Windows数据类型与API函数(MessageBox函数 和 ReadFile函数)
所有的Windows数据类型都是大写的所有的Windows API函数 大量地使用了Windows数据类型这里以这两个函数为例,它们的返回值和参数都大量地使用了Windows数据类型所有的Windows API函数都有W版和A版(后面会学到)先来看MessageBoxW函数四个参数:1. 表示Message窗口的所有者 , 如果填 NULL 就代表它的所有者是桌面
2016-08-31 10:01:34 1207
原创 Windows API 入门(什么是 Windows API?、 实例程序 、Windows API函数有几个?)
Windows API又叫做 API 函数, 是 Windows 的核心,从技术上讲,我们技术人员在 Windows 操作系统里做技术开发,Windows 对我们技术人员来说,里面有大量的 API 函数。API 叫做 “应用程序编程接口”(Application Programming Interface) ,我们在使用各种各样的编程语言在 Windows 开发时,都可以使用 API函数。
2016-08-29 16:47:54 40408 3
原创 NYOJ 114 某种序列(大数加)
某种序列时间限制:3000 ms | 内存限制:65535 KB难度:4描述数列A满足An = An-1 + An-2 + An-3, n >= 3 编写程序,给定A0, A1 和 A2, 计算A99输入输入包含多行数据 每行数据包含3个整数A0, A1, A2 (0 数据以EOF结束输出对于输入的每一行输出A99的值样例输入1 1 1
2016-08-28 17:27:24 995
原创 求逆序数
求逆序数时间限制:2000 ms | 内存限制:65535 KB难度:5描述在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。现在,给你一个N个元素的序列,请你判断出它的逆序数是多少。比如 1 3 2 的逆序数就是1。输入第一行输入一个整数
2016-08-28 01:12:54 538
原创 归并排序
问题很简单,就是给一串无序数字按某种顺序排序。这里介绍归并排序法该方法用了分治的思想时间复杂度为O(nlogn) 这是该算法中最好、最坏和平均的时间性能。空间复杂度为 O(n)比较操作的次数介于(nlogn) / 2和nlogn - n + 1。赋值操作的次数是(2nlogn)。归并算法的空间复杂度为:0 (n)归并排序比较占用内存,但却是一种效率高且稳定的算法
2016-08-28 01:05:38 714
原创 抽象类基本语法
#include using namespace std;////面向抽象类编程(面向一套预先定义好的接口编程)//解耦合 ....模块的划分class Figure //抽象类{public: //阅读一个统一的界面(接口),让子类使用,让子类必须去实现 virtual void getArea() = 0 ; //纯虚函数protected:private:};
2016-08-26 21:02:33 1215
原创 重载重写重定义
#include #include #include using namespace std;//重写 重载 重定义//重写发生在2个类之间//重载必须在一个类之间//重写分为2类//1 虚函数重写 将发生多态//2 非虚函数重写 (重定义)class Parent{ //这个三个函数都是重载关系public: void abc() { printf("a
2016-08-26 10:42:08 302
原创 虚析构函数
#include #include #include using namespace std;//虚析构函数class A{public: A() { p = new char[20]; strcpy(p, "obja"); printf("A()\n"); } ~A() { delete [] p; printf("~A()\n"); }pro
2016-08-26 09:52:07 265
原创 多态与多态案例
多态的思想面向对象3大概念封装: 突破c函数的概念....用类做函数参数的时候,可以使用对象的属性 和对象的方法继承: A B 代码复用多态 : 可以使用未来...多态很重要实现多态的三个条件好比C语言 间接赋值 是指针存在的最大意义是c语言的特有的现象 (1 定义两个变量 2 建立关联 3 *p在被调用函数中去间接的修改实参的值)实现多态的三个条件
2016-08-26 09:33:13 715
原创 单词拼接(有向图的欧拉回路)
http://acm.nyist.net/JudgeOnline/problem.php?pid=99单词拼接时间限制:3000 ms | 内存限制:65535 KB难度:5描述给你一些单词,请你判断能否把它们首尾串起来串成一串。前一个单词的结尾应该与下一个单词的道字母相同。如aloha
2016-08-24 16:48:59 771
原创 多继承语法
多继承语法示例#include using namespace std;class Base1{public: Base1(int b1) { this->b1 = b1; } void printB1() { cout<<"b1:"<<b1<<endl; }protected:private: int b1;};class Base2{publ
2016-08-23 15:49:28 451
原创 继承中的同名成员变量和函数
同名成员函数#include using namespace std;class A{public: int a; int b;public: void get() { cout<<"b "<<b<<endl; } void print() { cout<<"AAAAA "<<endl; }protected:private:};class
2016-08-23 15:41:18 468
原创 UVA - 297 Quadtrees(四分图)
A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again be split in four sub q
2016-08-22 11:41:17 432
原创 继承中的构造和析构、继承与组合混搭下的构造和析构
继承中的构造和析构#include using namespace std;class Parent{public: int a; int b;public: Parent(){ cout << "调用了父类的无参构造函数" << endl; this->a = 1; this->b = 2; }
2016-08-21 21:17:08 306
原创 继承的概念、一些基础的语法与类型兼容性原则(基础)
程序员之间的类继承图。。(打个比方)其实,继承就是某一种类与类之间的关系,派生类(子类)中可以继承基类(父类)中的某些属性无论是下面哪一种继承,子类都无法访问或继承父类中的私有属性(private永远是private)protect成员比较特殊,可以在子类中进行访问,但无法被外界访问(可以类比成父亲的银行卡密码,你可以继承,但不能给别人)1. public 继承:原来父类中的(
2016-08-21 21:14:23 569
转载 sscanf函数用法详解
sscanf函数用法详解 名称: sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: Int sscanf( string str, string fmt, mixed var1, mixed var2 ... ); int scanf( const char *format [,argument]... ); 说明:
2016-08-19 19:10:52 587
原创 UVA - 11988 Broken Keyboard(用数组实现链表)
You'retyping a long text with a broken keyboard. Well it's not so badly broken. Theonly problemwiththe keyboard is that sometimes the \home" key or the \end" key getsautomatically pressed(internal
2016-08-18 16:00:56 329
原创 HDOJ 1176 免费馅饼(dp)
题目链接http://acm.split.hdu.edu.cn/showproblem.php?pid=1176免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 42119 Accepted Submission
2016-08-18 11:50:44 280
原创 如何自己实现模板类(简单案例——顺序表)
可以将模板类SeqList的定义及成员函数的实现代码全部写到SeqList.h头文件中,则在实例化该类后可进行基本的线性表操作具体的代码怎么写,其实核心就是 template 其中 T 就是一个未知的类型,在写头文件时,变量的类型都用T代替。用户在使用此模板时应该把要使用的变量类型填入进去(可以是基本类型 如 int char 等等 也可以是用户自定义的复杂类型 如 结构体、类)下面是S
2016-08-18 10:07:14 2383
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人