- 博客(124)
- 资源 (8)
- 收藏
- 关注
原创 并查集模板
//并查集算法 void init(int vn){ for(int i = 0;i <= vn;++i) Father[i] = i; } int find(int x){ return (Father[x] == x) ? x : Father[x] = find(Father[x]); } inline v
2017-03-23 13:59:54
468
转载 莫队算法模板
#include #include using namespace std;int const SIZE = 30100;int const BLOCK_SIZE = 200;//分块大小为接近根号n的整数,这样容易调试struct _t{ int s,e; int idx;};bool operator < (_t const&lhs,_t const&rh
2017-03-11 18:37:39
584
原创 数论求逆元的三种方法
扩展欧几里德算法//非递归的扩展欧几里德算法 //返回a、b的gcd,同时x、y满足ax+by=gcd int_t exEuclid(int_t a,int_t b,int_t&x,int_t&y){ int_t x0 = 1, y0 = 0; int_t x1 = 0, y1 = 1; x = 0; y = 1; int
2017-03-11 18:29:04
1935
转载 高斯消元 浮点数模板
//接口:Gauss();解存在x数组中。equ,var分别表示方程个数和变量的个数,(因为是变量 的个数不算常数的个数)要赋值。a就是行列式,其中常数是在方程右侧的符号。 int const maxn = 2000; const double eps=1e-10; double a[maxn][maxn],x[maxn]; int equ,var; int Gauss()
2017-03-03 11:07:21
648
原创 高斯消元模板
//基本版#include#include#include#include#includeusing namespace std;const int SIZE = 50;int a[SIZE][SIZE];//增广矩阵int x[SIZE];//解集bool free_x[SIZE];//标记是否是不确定的变元/*void Debug(int equ,int var)
2017-03-03 09:48:41
297
原创 sublime text 3 c++ 运行时解决cin输入问题( ubuntu)
网上看了太多了版本,没一个是正确的,我的意思是没一个实在ubuntu下的版本cmd的命令windows mac linux 都是不一样的所以我参考mac下的版本写个一个ubuntu的tools->build system->New build system:清空原来的内容,输入下面:{"cmd" : ["gnome-terminal -x bash -c \"g++ $file
2017-02-27 11:06:11
3732
转载 linux 删除软件
apt-get 卸载的几个常用命令apt-get purge / apt-get –purge remove #删除已安装包(不保留配置文件)。 #如软件包a,依赖软件包b,则执行该命令会删除a,而且不保留配置文件apt-get autoremove #删除为了满足依赖而安装的,但现在不再需要的软件包(包括已安装包),保留配置文件。apt-get remove #删除已
2017-01-25 11:43:56
4158
原创 linux 文件属性与权限(简单讲解)
在目录下输入 ls -l (简写为ll),即可看到当前目录下文件下文件的属性 第一个箭头表示是文件性质 如果是文件夹则为d , 否则为- 后面9个属性可以分为三组 每组都由 rwx 构成(1)
2017-01-23 10:21:57
319
转载 linux deb包的安装
deb是debian linus的安装格式,跟red hat的rpm非常相似,最基本的安装命令是:dpkg -i file.deb dpkg 是Debian Package的简写,是为Debian 专门开发的套件管理系统,方便软件的安装、更新及移除。所有源自Debian的Linux发行版都使用dpkg,例如Ubuntu、Knoppix 等。以下是一些 Dpkg 的普通用法:
2017-01-15 11:52:52
482
转载 Linux 常用的软件
出处https://www.sysgeek.cn/linux-photo-management-software/http://www.oschina.net/news/13947/five-lightweight-music-players/Linux 下五款轻量级音乐播放器(开源) 本文介绍 Linux 系统下 5 款轻
2017-01-15 11:41:20
430
原创 python3 操作MySQL
#-*-coding:utf8-*-'''Created on 2017年1月8日@author: bitwater'''import pymysqlclass Mysql( ): def __init__(self,dbname): self._dbname = dbname def connect(self , dbname ):
2017-01-13 13:39:07
456
原创 Python 基本库函数
# python 库函数# 1. format # 它通过 {} 和 : 来代替 % # @1 通过位置 # '{0},{1}'.format('kzc',18) # '{1},{0}'.format('kzc',18) # @2 通过关键字参数 # '{name},{age}'.format(age=18,name='kzc') # @3 通过对象属性
2016-12-28 20:34:16
1027
原创 linux python3 安装lxml失败
pip3 install lxml一系列报错........................ ********************************************************************************* Could not find function xmlCheckVersion in library libxml2.
2016-12-22 17:31:09
3923
转载 linux c .c文件编译 基本语法
1. .c文件编译过程 c->i->s->o->out中间的四个过程分别为 预处理,汇编,编译,链接 //一步到位的编译命令 gcc test.c -o test.out (1) 预处理 //预处理的作用是展开头文件,以及对宏进行替换 //在生成的以i为后缀名的文件中进行二维展开 gcc -E test.c -o test.i (只生成.i文件 ) g
2016-12-22 11:32:24
872
原创 SQL server char ,nchar 模糊匹配的严重问题
nchar ( n ) , char ( n ) 关于上面两个类型大家都不陌生, 固定长度的字符串类型, 只不过第一个是unicode要存两个字节,而char只要一个字节, 所以在一开始学sql的时候,都是用nchar,但是这两个类型还有一个问题如果不足n个长度 , 会自动在末尾补空格,这句话经常被忽略, 但其实这句话反映了一个问题,存进去的字符串其实根本就不
2016-12-21 12:25:50
831
转载 python sdk 发一个新浪微博
当时也是看了这个代码才学会了sdk怎么用,虽然写的简单,但是学会了套路,留一发,以后当模板# -*- coding: utf-8 -*-import weibodef run(APP_KEY , APP_SECRET , CALL_BACK): # weibo模块的APIClient是进行授权、API操作的类,先定义一个该类对象,传入参数为APP_KEY, APP_SEC
2016-12-19 20:26:39
343
原创 python sdk 获取新浪微博签到信息
具体参考http://www.liaoxuefeng.com/article/00137389308005720bf24cb6cf14d9e897e7026dbc6a842000不得不说廖大神这个sdk 在我这个新手看来写的真是太完美了,接口调用写成动态,封装授权,返回jsondict 处理起来实在是方便# -*- coding: utf-8 -*-'''Created on 2
2016-12-19 20:22:59
3499
原创 记录一些 用过的 cmd 命令
//刷新dnssystem("ipconfig /flushdns");//刷新网络 ( 可能要重启 )system("netsh winsock reset");WinExec("SystemPropertiesPerformance.exe",SW_SHOW );//设置ip 掩码 网关system ( "netsh interface ip set address \"本
2016-12-14 14:39:40
498
原创 MFC string CString char wchar 相互转换
实在太多也太难整理,只能遇到一次补一个,网上很多都是错的,先把遇到的写出来,慢慢更新......// wcharTochar void wcharTochar(const wchar_t *wchar, char *chr, int length){ WideCharToMultiByte(CP_ACP, 0, wchar, -1, chr, length, NULL, NU
2016-12-14 14:33:38
1264
转载 MFC 是创建的程序打开时默认获得管理员权限
WIN7下应用程序可以以普通用户身份运行,或者需要用管理员身份运行。用VS2010制作的软件,默认是以普通用户的身份启动的。在VS2010中,可以设置程序在启动时,是以何种身份启动。进入:Project->Property…->Configuration Properties->Linker->Manifest File->UAC Execution Level默认的级别为“asInv
2016-12-14 14:28:14
2641
原创 MFC 创建模式对话框与非模式对话框
// 模式对话框 my_about cb; cb.DoModal(); //非模式对话框 my_about *cb = new my_about; cb->Create(IDD_myabout,this); cb->ShowWindow(SW_SHOW);vc2008 mfc 默认添加到对话框会有 确定跟取消, 但这俩框在资源视图里面还看不到,不晓的为什么,但是处理函
2016-12-14 14:26:53
1528
原创 MFC 获取当前路径
//为了避免可能出现的问题 直接获取当前程序的路径 ,然后把当前程序后缀删掉 wchar_t buf[MAX_PATH];GetModuleFileName(NULL,buf, MAX_PATH);int i = wcslen(buf)-1;while ( buf[i] != L'\\' && i >= 0)i--; buf[i+1] = L'\0';//buf 存的就是当前路径
2016-12-14 14:20:32
424
转载 python sdk 登入微博
http://blog.youkuaiyun.com/dongtingzhizi/article/details/9097735http://blog.youkuaiyun.com/dongtingzhizi/article/details/9098527# -*- coding: utf-8 -*-import weibodef run(APP_KEY , APP_SECRET , CALL_BACK
2016-12-12 11:13:16
624
原创 python2 爬取新浪帐号所有微博
# -*- coding: utf-8 -*- import requestsfrom lxml import etreeimport codecsclass weibo: cookie = {"Cookie": "_T_WM=10e482205eab95a2636214f62e66b6e7;\ SUB=_2A251T7kXDeRxGeNG6VYV8ivLy
2016-12-12 11:11:28
1094
原创 日期类模板 , 该日期是第几天,第几天的日期,两个日期的差 ,一个日期的n天之后的日期...
http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=2315http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=10498以上是验证模板的题目/* * 模板有风险,使用需谨慎 , * 在获取某年的天数时,可以打
2016-12-10 20:27:43
580
原创 哈理工第六届程序设计团队赛 G ox
http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=2320problem G. OXTimeLimit: 1000ms Memory Limit: 100000kDescriptionKim喜欢玩井字棋。但是他从来都没有赢过:)Kim非常好奇井字棋是否有一个必胜的策略。给定一个
2016-12-10 18:46:37
486
原创 哈理工第六届程序设计团队赛 E Mod
http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=2318problem E . ModTimeLimit: 1000ms Memory Limit: 100000kDescriptionKim刚刚学会C语言中的取模运算(mod)。他想要研究一下一个数字A模上一系列数后的结果是
2016-12-10 18:38:34
590
原创 循环节定理+bsgs 哈尔滨理工ACM程序设计全国邀请赛(网络同步赛) G.Recurring Decimal
G Recurring DecimalDescriptionAs we all know, any scores are can be written in an infinite recurring decimal or a finite decimal ,for example,1/7 can be written in 0.(142857).(recurring peri
2016-12-09 20:07:26
684
原创 数论 BSGS 模板
虽然看不懂原理,但是实现还是不难,留一发模板....//POJ 2417//baby_step giant_step// a^x = b (mod n) n为素数,a,b < n// 求解上式 0 <= x < n的解#include #include #include #define MOD 76543using namespace std;int hs[MOD], hea
2016-12-09 19:39:01
442
原创 BSGS 算法 XDoj 1077: 循环节长度
题意很简单,就是给出p,q,求p/q的循环节长度。这里先给一个定理接下来我们只要套用这个定理, 10 ^e = 1 (mod a ) 可以用BSGS算法求得,但是要注意e>0 ,显然e == 0 的时候恒成立#include #include #include #define MOD 76543using namespace std;int hs[MOD], hea
2016-12-09 19:35:00
845
原创 快速傅立叶 哈尔滨理工ACM程序设计全国邀请赛(网络同步赛) D. Pairs
PairsDescriptionGiven N integers,count the number of pairs of integers whose sum is less than K. And we have Mqueries. InputThe first behavioris an integer T (1 The next M lines,ea
2016-12-08 01:49:53
984
原创 MFC double char int 与 CString 相互转换
1. CString 转int long double CString str = "";double x = _wtof(str);int x = _wtoi(str);long x = _wtol(str);atoi atof 这些函数会报错因为参数要是( const char* )2. int ,double ,long 转CStringstr.Format(_T("%
2016-12-05 14:06:55
728
原创 ubuntu server xfce 配置(亲测)
一 . 配置中文环境1,安装字体方法一. 直接把windows的字体复制到linux上把/Windows/Fonts/ 的想要的字体复杂到这个目录/usr/share/fonts/windows/方法二.安装字体管理器sudo apt-get install font-manager直接选择/Windows/Fonts/ 里面的字体安装2.配置语言环境sud
2016-12-04 17:57:41
8365
原创 ubuntu server 语言设置
我们需要修改配置文件/etc/default/locale中文设置为:LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh" LANG="zh_CN.UTF-8"LANGUAGE="zh_CN:zh"修改为:LANG="en_US.UTF-8" LANGUAGE="en_US:en" LANG="en_US.UTF-8"
2016-12-04 15:34:28
532
原创 初学api,瞎写点
#include #include #include #include #include #include #include #include #include #include #include #include #include #define endll printf("\n")using namespace std;int map[100][100] = {0
2016-12-04 00:04:55
354
原创 c++产生随机数
1.rand()功能:随机数发生器用法:int rand(void)所在头文件: stdlib.hrand()的内部实现是用线性同余法做的,它不是真的随机数,因其周期特别长,故在一定的范围里可看成是随机的。rand()返回一随机数值的范围在0至RAND_MAX 间。RAND_MAX的范围最少是在32767之间(int)。用unsigned int 双字节是655
2016-12-02 13:37:30
649
原创 控制台定时关机
#include #include int print(){ printf(" ╪╪╪╪╪╧╧╧╧╧╧╧╪╪╪╪╪╪\n"); printf("╔════╧C语言关机程序 ╧═════╗\n"); printf("║※1.实现x分钟内的定时关闭计算机 ║\n"); printf("║※2.立即关闭计算机 ║\n");
2016-12-02 13:20:16
549
原创 控制台贪吃蛇
#include //#include //#include #include #include using namespace std;int const x_max = 25;int const y_max = 70;int const snake_speed = 200;const char FOODchar = '+';const char SNAKEchar = '
2016-12-02 13:05:21
276
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人