自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(67)
  • 收藏
  • 关注

原创 cv-仿射变换

import cv2import numpy as npimport PILdef get_3rd_point(a, b): direct = a - b return b + np.array([-direct[1], direct[0]], dtype=np.float32)src=np.array([[7,5],[7,2],[4,2]])#width*heig...

2019-11-28 14:46:21 334 2

原创 openCV中文手册

http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html

2019-11-26 15:56:56 582

原创 cuda

RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same加载训练集和验证集的input时改为input.cuda()具体在train() 与validate()函数的enumerate后面input=input.cuda()...

2019-11-22 17:10:01 423 1

原创 Pytorch可视化-visdom

https://www.cnblogs.com/fanghao/p/10256287.htmlhttps://blog.csdn.net/qq_18649781/article/details/89188326

2019-11-18 09:46:20 127

原创 Pytorch-CIFAR-10数据集下载问题

错误:[Errno socket error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed产生这个问题的原因在于python本身,pyhon升级到2.7.9以后,引入了一个新特性,当使用urllib打开https的链接时,会检验一次ssl证书。而当目标网站使用的是自签名证书时,就会抛出urllib2.URLErro...

2019-10-28 16:46:49 2248

原创 C++-查找模板-lower_bound()、upper_bound()

查找时前先要对数据预处理排序(升序)数组形式​#include<cstdio>#include<iostream>#include<algorithm>#include<vector>using namespace std;struct node{ int x; int y; node(int x=0,int y=0):x(...

2018-10-16 21:24:16 200

原创 C++-getline()

#include<cstdio>#include<iostream>#include<cstring>using namespace std;int main(){ int T; cin>>T; getchar(); // while(T--){ string str; getline(cin,str);//cin>&...

2018-09-10 21:17:01 3663

原创 训练指南-3.1数据结构-uva11991(map)

#include<cstdio>#include<iostream>#include<map>#include<vector>using namespace std;map<int,vector<int> > a;int main(){ int n,m,x,y; while(cin>>n&am

2018-09-10 19:54:45 136

原创 Python-Excel获取最大行与列

《python编程快速上手》中的第12章:处理Excel电子表格。get_highest_row()和get_highest_column()在最新版的openpyxl模块中已经被删除了,取而代之的是max_row和max_column两个方法。import openpyxlwb1=openpyxl.load_workbook('附件1-葡萄酒品尝评分表.xlsx')sheet1=w...

2018-07-26 17:22:44 18036

原创 Python-excel按指定顺序自动排序

import openpyxlwb1=openpyxl.load_workbook('tsp_result.xlsx')wb2=openpyxl.load_workbook('144.xlsx')sheet1=wb1.get_active_sheet()sheet2=wb2.get_active_sheet()for i in range(1,146): te=...

2018-07-26 17:09:23 16173

原创 Matlab-图像点上标序号

x=rand(10,1)*10; y=rand(10,1)*10; %x,y表示任意10个点的坐标plot(x,y,'*');for i=1:10 text(x(i)+0.01,y(i)+0.01,num2str(i)) ; %加上0.01使标号和点不重合,可以调整end ...

2018-07-25 19:09:30 5330

原创 MATLAB-逐行写入txt

fid=fopen('D:\数学建模\s1.txt','wt');Sl=length(S);%S为包含13个矩阵的元胞for k=1:13 [row,col]=size(S{k}); fprintf(fid,'%g\n\n',k); for i=1:row for j=1:col if(j==col) ...

2018-07-23 15:31:08 9388 1

原创 MATLAB-图片保存为原始大小(无多余白框)

matlab显示的图片,或者用matlab画出来的图片,手动保存时四周有白边。用File-Save或者Save As保存后,发现图片的四周有白边,有时候这些白边不是我们想要的,这是为什么呢,怎么办呢?这是因为File-Save的方式保存的是整个窗口,要大于整个图片,可是我们只是想要窗口中的图片,该如何操作呢?用保存imwrite函数吧:imwrite(a, 'a.jpg', '...

2018-07-23 15:05:50 5446 2

原创 2018蓝桥杯国赛c++b组-第四题-调手表

每次只能走一步或k步从原点开始bfs即可#include<cstdio>#include<iostream>#include<cstring>#include<queue>using namespace std;const int maxn=100000+5;int d[maxn];int main(){ int n,k; whil...

2018-06-08 10:59:23 1352

原创 入门经典-7.1简单枚举,182-uva725除法-排列,sprintf(),生成测试法❤难度:1

#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;char buf[99];int main(){ int kase=0,n; while(cin>>n&&n){ int c...

2018-03-31 14:18:48 149

原创 入门经典-6.3.3二叉树递归遍历-uva699下落的树叶-先序遍历-⭐⭐⭐⭐⭐难度:1

#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;const int maxn=100000;int sum[maxn];//void build(int p){ int v; cin>>v...

2018-03-28 21:23:01 126

原创 入门经典-6.3.3二叉树递归遍历-uva839天平-先序遍历,引用传值

// 题意:输入一个树状天平,根据力矩相等原则判断是否平衡。采用递归方式输入,0表示中间结点// 算法:在“建树”时直接读入并判断,并且无须把树保存下来#include<iostream>using namespace std;// 输入一个子天平,返回子天平是否平衡,参数W修改为子天平的总重量bool solve(int& W) { int W1, D1, W...

2018-03-28 16:36:11 175

原创 C++-结构体

#include<cstdio>#include<iostream>#include<algorithm>//system()using namespace std;struct point { int x,y;//① //构造函数 point(int x=0,int y=0){//可以初始化为0 直接调用point()则默认初始化为相应值...

2018-03-28 09:10:07 147

原创 入门经典-5.2.4映射:map-113-uva156反片语-string排序,map⭐⭐⭐⭐⭐难度:1

#include<cstdio>#include<iostream>#include<map>#include<vector>#include<cstring>#include<algorithm>using namespace std;map<string,int> cnt;vector&amp

2018-03-21 22:21:11 184

原创 入门经典-5.2.3集合:set-112-uva10815安迪的字典-string,sstream,iterator,set⭐⭐⭐⭐⭐难度:1

#include<cstdio>#include<iostream>#include<cstring>#include<set>#include<sstream>using namespace std;set<string> dict; int main(){ string s,buf; while(cin&...

2018-03-21 21:29:14 143

原创 入门经典-习题7-1,109-uva208消防车-DFS,并查集,打印路径,利用set保存边,字典序,STL⭐⭐⭐⭐⭐复杂度:3

#include<cstdio>#include<iostream>#include<cstring>#include<vector>#include<map>#include<set>#include<sstream>#include<algorithm>//find()

2018-03-18 17:02:00 412

原创 入门经典-习题5-5,41-uva10391复合词-string assign,set⭐⭐⭐⭐⭐难度:1

对set集合的每个单词遍历不同位置切分,查询左右两部分是否在集合中不要直接枚举左右两部分判断复合词是否在集合中时间复杂度较大#include<cstdio>#include<iostream>#include<set>#include<cstring>using namespace std;set<string> words;...

2018-03-17 22:50:25 180

原创 入门经典-6.4图-163-uva1103古代象形符号-四连块,DFS,种子填充,图像识别⭐⭐⭐⭐⭐复杂度:4

#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<vector>#include<set>using namespace std;const int maxh=200+10;const int maxw=...

2018-03-17 20:59:27 333

原创 入门经典-6.3树和二叉树-4非二叉树-uva297四分树-先序遍历,黑白图像⭐⭐⭐⭐⭐难度:2

#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int maxn=1024+10;const int len=32;char s[maxn];//这个声明和下个声明调换位置 会WA 原因不详 int buf[len][len],cnt;voi...

2018-03-16 21:13:45 250

原创 入门经典-7.4回溯法-1八皇后

一般n皇后代码如下 输入n 输出方案个数#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int maxn=30;int n,tot;//tot初始化 int vis[maxn][3];int C[maxn];void search(int c...

2018-03-13 22:03:27 1099

原创 入门经典-6.2链表-143-uva11988悲剧文本⭐⭐⭐⭐⭐难度:2

注意在用iostream时 数组名不能命名为next和last在iostream已经定义!cur代表光标指向当前最新已有的字母(开始时指向虚拟头结点 Next[0]指向0)#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int maxn=100000...

2018-03-13 17:48:48 119

原创 训练指南-1.3-高效算法-LA2965侏罗纪-中途相遇法,子集枚举,映射⭐⭐⭐⭐⭐难度:3

#include<cstdio>#include<iostream>#include<map>using namespace std;const int maxn=30;int n,A[maxn];char s[1000];int bitcount(int x){ return x==0?0:bitcount(x/2)+(x&1);//x...

2018-03-12 20:58:44 178

原创 训练指南-2.1-计数-uva11401数三角形-递推

题目:有多少种方法可以从1,2,3,...,n中选出三个数,构成三角形#include<cstdio>#include<iostream>using namespace std;long long f[1000010];int main(){ f[3]=0; for(long long x=4;x<=1000000;x++){ f[x]=f[x-1]+...

2018-03-05 17:02:13 130

原创 C++-7.2.4-下一个排列(next_permutation)

#include<cstdio>#include<iostream>#include<algorithm>using namespace std;int main(){ int p[5]={5,4,3,2,1}; sort(p,p+5);//数组必须初始化 因为该函数从当前排列按顺序枚举下一个 不初始化只会枚举一个54321; do{ for...

2018-03-04 18:02:04 845

原创 训练指南-2.2-递推-LA3516-多叉树遍历-溢出

#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int maxn=300+10;const int MOD=1000000000;typedef long long LL;char S[maxn];int d[maxn][maxn];int...

2018-03-03 20:41:11 218

原创 10.3.1-递推-斐波那契数列变形-上台阶

一个关于台阶的问题。如果我每一步只能迈上1个或者2个台阶。先迈左脚,然后左右交替,最后一步迈右脚,也就是说一共要走偶数步,那么迈上n级台阶,有多少种不同的上法呢?输入第一行一个整数n,表示台阶的数量。输出结果占一行,表示用偶数步,迈上n级台阶不同的方案数目,测试数据保证结果不超出int范围样例输入10样例输出44分析:F(n)表示n个台阶用偶数步上的方法 G(n)表示n个台阶奇数步上的方法F(n)...

2018-02-21 17:41:43 398

原创 C++-二进制法枚举子集

#include<cstdio>#include<iostream>using namespace std;void print_subset(int n,int s){ for(int i=0;i<n;i++){ if(s&(1<<i)) cout<<i; } if(s!=0)//第一次循环不需要换行 cou...

2018-02-18 20:24:04 906

原创 C++-二进制数一的个数-bitcount()函数

#include<cstdio>#include<iostream>using namespace std;int NumberOf1(int n){//返回二进制一的个数 注意类型 int count=0; unsigned int flag=1;//flag从1开始 每次循环左移一位 与n做&运算 判断该位是否为1 while(flag<=...

2018-02-18 20:20:24 4975

原创 MATLAB-logistics回归(人口增长阻塞模型)

%logistics回归(人口模型)a=textread('data4.txt');x=a([2:2:6],:)';x=nonzeros(x);%%相应时间人口t=[1790:10:2000]';%%已知数据时间点%x=[544 1376 1415 1004]';%t=[1950 2015 2030 2050]';t0=t(1);x0=x(1);fun=@(cs,td)cs(1)./(1+(cs(...

2018-02-12 16:20:11 22266 26

原创 MATLAB-最小集合覆盖-贪心近似算法-以美国快递仓库选址覆盖为例

num=[];z=zeros(353,546);N=sum(sum(s{54}==1));U=s{54};Q=z;s0=s;t=0;for j=1:40 max=0; for i=1:53 if sum(sum(s0{i}&U==1))/N>max t=i; max=sum(sum(s0{i}&U==1))/N; end

2018-02-07 20:35:26 6780 5

原创 MATLAB-图片特定颜色区域提取(矩阵)

a=imread('48.png');%图片路径名称 a为m*n*3矩阵 m,n分别为宽高 3表示RGB分量dd1=(a(:,:,1)=240&a(:,:,2)=205&a(:,:,3)=30);%由RGB颜色范围抠图 结果为逻辑矩阵(只包含0与1)[m,n]=size(dd1);z=zeros(m,n);image(cat(3,dd1,z,z))

2018-02-07 20:23:54 17895

原创 MATLAB-利用逻辑运算对当前矩阵状态一次更新-边界内部填充

n=50;m=50;k=20;%执行次数z=zeros(n,m);ve=z;number=37;r=z; %r为边界 初始化r([5,45],:)=1;%边界值为1r(:,[5,45])=1;ve=r;%veg此时为边界(值均为1)加一个值为37的点ve(25,25)=37;for i=1:k X=find(ve==1);%寻找边界的序号 保存在X 因为靠

2018-02-06 20:48:10 606

原创 Python-NumPy

>>> randMat=mat(random.rand(4,4))>>> randMatmatrix([[0.69167291, 0.88622401, 0.6849104 , 0.02836564], [0.43819917, 0.54033237, 0.48791504, 0.17920281], [0.84127894, 0.9706528 , 0.623

2018-02-04 12:58:35 178

原创 Python-GUI自动控制鼠标键盘

18.318.3.1import pyautoguifor i in range(10):   pyautogui.moveTo(100,100,duration=0.25) #绝对位置   pyautogui.moveTo(0,100,duration=0.25)   pyautogui.moveTo(200,200,duration=0.25)pyautogui.m

2018-02-02 15:09:58 532

原创 9.5-uva-1627-Team them up-动态规划-图-连通分量-DFS(WA)

#include#include#include#include#includeusing namespace std;const int maxn=100+5;int d[maxn][maxn];vector G[maxn],Q,T[maxn][3];int id[maxn];int flag,cnt;int t[3]; int a[maxn];bool dfs(int

2018-02-01 21:13:35 136

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除