自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

一入代码深似海

个人学习笔记

  • 博客(39)
  • 收藏
  • 关注

原创 Python装饰器的学习

装饰器是Python语言一个别具特色的功能

2020-07-30 01:04:27 144

原创 洛谷习题 P1777 [模版]快排

#include<bits/stdc++.h>using namespace std;int partition(int A[],int low,int high){ int pivot=A[low]; while(low<high){ while(low<high&&A[high]>=pivot)high--; A[low]=A[h...

2020-02-02 15:24:41 178

原创 洛谷习题 P1865欧拉筛

O2优化是个好东西#include<bits/stdc++.h>using namespace std;int Prime[50900000];bool Flag[100000000];void OulaSieve(){ int pos=0; for(int i=2;i<=100000000;i++){ if(Flag[i]){ Prime[pos++]...

2020-02-02 15:12:03 178

原创 洛谷习题 P1086花生采摘【一维矩阵模拟二维、参数传递】

#include<bits/stdc++.h>using namespace std;void findMax(int field[],int M,int N,int &posx,int &posy,int &max){ posx=0;posy=0;max=0; for(int i=0;i<M;i++){ for(int j=0;j<N...

2020-02-01 22:01:07 219

原创 洛谷习题 P3383 [模版]欧拉筛

#include<bits/stdc++.h>using namespace std;int prime[10000000];bool flag[10000000];void OulaSieve(int N){ int pos=0; for(int i=2;i<=N;i++){ if(flag[i]){ prime[pos]=i; pos++; ...

2020-01-31 16:31:45 160

原创 洛谷习题P1056

#include<bits/stdc++.h>using namespace std;int main(){ int M,N,K,L,D; cin>>M>>N>>K>>L>>D; int stu[D][4]; for(int i=0;i<D;i++){ cin>>stu[i][0]>&...

2020-01-17 11:18:31 147

原创 洛谷习题P1540——使用vector容器

//使用vector容器//由于可以查找容器中的元素,所以比queue更方便#include<bits/stdc++.h>using namespace std;int main(){ int M,N,text,cnt=0; cin>>M>>N; vector<int> key; for(int i=0;i<N;i++){ ...

2020-01-15 10:54:03 578

原创 bits/stdc++.h

#include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include <deque> #include <vector> #include <queue&gt...

2020-01-15 10:43:26 362

原创 洛谷习题P1563

#include<bits/stdc++.h>using namespace std;class tag{ public: int num; string Name;};int main(){ int n,m; cin>>n>>m; tag Tag[n]; int find[m][2]; for(int i=0;i<n;i+...

2020-01-14 00:59:34 153

原创 洛谷习题P1328

#include<bits/stdc++.h>using namespace std;int fight(int A,int B){ if(A==0&&B==0)return 0; else if(A==0&&B==1)return 0; else if(A==0&&B==2)return 1; else if(A==0&a...

2020-01-14 00:26:23 274

原创 洛谷习题P1022计算器改良

#include<bits/stdc++.h>using namespace std;char EQ,X;int b,k,flag=1,F=1,num;bool r;int main(){ while(cin>>EQ){ if(EQ=='-'){b+=F*flag*num;F=-1;num=0;r=0;} if(EQ=='+'){b+=F*flag*n...

2020-01-09 17:16:32 141

原创 图的存储

#include<bits/stdc++.h>using namespace std;//--邻接矩阵定义-------#define MaxVertexNum 100typedef char VerTexType;typedef int EdgeType;typedef struct{ VertexType Vexp[MaxVertexNum]; EdgeType ...

2019-11-24 22:15:21 125

原创 洛谷习题P1014cantor表(取整ceil floor)

#include<bits/stdc++.h>using namespace std;int main(){ int h,N,pos; float H; cin>>N; H=(sqrt(1+8*N)-1)*0.5; h=ceil(H);//向上取整用ceil,向下取整用floor pos=N-(h-1)*(h)*0.5; //cout<&l...

2019-10-28 12:36:36 92

原创 洛谷习题P2089烤鸡

//我不知道应该怎么样保存数据,所以程序循环了两次,第一次不输出结果#include<bits/stdc++.h>using namespace std;int SUM(int A[]){ int sum=0; for(int i=0;i<10;i++){ sum+=A[i]; } return sum;}void disp(int A[]){ i...

2019-10-26 02:18:30 226

原创 洛谷习题P1579哥德巴赫猜想升级版

#include<bits/stdc++.h>using namespace std;bool IsPriNum(int N){ for(int i=2;i<=sqrt(N);i++){ if(N%i==0){ return false; } } return true;}int main(){ int n; cin>>n; i...

2019-10-26 00:54:07 165

原创 洛谷习题P1618三连击升级版

#include<bits/stdc++.h>using namespace std;bool IsRightNum(int i,int j,int k){ int m[9]; m[0]=i/100; m[1]=(i%100)/10; m[2]=i%10; m[3]=j/100; m[4]=(j%100)/10; m[5]=j%10; m[6]=k/10...

2019-10-26 00:32:42 165

原创 洛谷习题P1478摘苹果升级版

#include<bits/stdc++.h>using namespace std;int main(){ int AppNum, Strength, ChairH, ArmL; cin>>AppNum>>Strength; cin>>ChairH>>ArmL; int a[AppNum]; int m,...

2019-10-25 23:41:46 132

原创 数据结构——队列

Queue,一段入队,另一端出队的受限线性表FIFO队列的顺讯存储结构(顺序队)1、顺序队存储类型#define MaxSize 50typedef struct{ ElemType Data[MaxSize]; int front,rear;}SqQueue;规定,初始时两个指针都指向数组下标为零的位置...

2019-06-28 18:50:25 173

原创 数据结构——栈

stack,只允许在一段进行插入或删除的受限线性表先进后出的结构栈的顺序存储(顺序栈)1、顺序栈的存储类型#define MaxSize 50typedef struct{ ElemType data[MaxSize]; int top;}SqStack;/*栈顶指针S.top初始时设置S.top==1栈顶元素S.data[S.top]栈空S.top==-1栈满S.top...

2019-06-08 16:03:51 871

原创 数据结构——线性表(双链表、循环链表、静链表)

双链表单链表只有一个后继指针,所以只能从头节点依次向后遍历。要访问某个节点的前驱节点,只能从头开始遍历。访问后继节点时间复杂度为O(1),访问前驱节点为O(n)。为了克服这个缺点,引入双链表。1、双链表单个节点。priordatanextprior为前驱指针域data为数据域next为后继指针域节点类型描述如下:typedef struct DNode{...

2019-06-08 14:01:26 107

原创 数据结构——线性表(单链表)

线性表的链式存储顺序表的插入、删除操作都需要移动大量的元素,因此引入了线性表的链式存储。它不要求逻辑上相邻的两个元素在物理位置上也相邻,因此,插入、删除操作只需要修改指针。1、单链表单个节点datanextdata为数据域,存放数据元素next为指针域,存放后继节点的地址节点类型描述如下typedef struct LNode{ ElemType data;...

2019-06-04 20:51:43 222

原创 函数参数的三种传递方式C++

1、值传递#include<bits/stdc++.h>using namespace std;void swap(int a,int b){ int temp; temp=a; a=b; b=temp;}int main(){ int a,b; cin>>a>>b; swap(a,b); cout<<a<<...

2019-05-28 15:36:45 172

原创 重新学习递归

递归思想掌握不够熟练还得重头看起//所有循环都能写成递归式例一 斐波那契最基础最典型的样例就是斐波那契数列1 1 2 3 5 8 13 21 ...可以看出,递推公式为:f[n]=f[n-1]+f[n-2]需要注意的是,它的初始项有两个,意味着出口需要写两个,即:1、f[n]=f[n-1]+f[n-2]2、f[1]=13、f[2]=1代码如下#include<...

2019-05-25 16:27:41 115

原创 for循环执行步骤

for(A;B;C){ D; } E;Created with Raphaël 2.2.0A i=0B? i<10D 循环体C i++E 下一条yesno

2019-05-25 16:06:10 1581

原创 数据结构——线性表(顺序存储)

线性表的顺序存储顺序存储的线性表称顺序表顺序存储特点建立方式1地址连续,2随机存取,3顺序存储1首地址,2储存空间大小,3表长1静态,2动态优点缺点存储密度大,不需要为元素的逻辑关系额外开辟空间插入和删除操作需要移动大量元素,平均时间复杂度O(n)随机存取,可快速存取表中任一元素对存储要求高,会出现存储碎片顺序存储1、线性表是一种逻辑结构,存储单元地址连...

2019-05-25 15:49:56 1497

原创 洛谷习题P1036递推or深度优先搜索dfs###非常重要###

想递推公式啊!!!假如每次加三个数sumijksum[0]f[0]f[1]f[2]sum[1]f[0]f[1]f[3]sum[2]f[0]f[1]f[4]sum[…]f[0]f[1]f[n-1]…………sum[…]f[0]f[2]f[3]sum[…]f[0]f[2]f[4]sum[…]

2019-05-21 19:23:35 122

原创 洛谷习题P1149火柴棒等式

找到关系方程就行了a+b=cX[a]+X[b]+X[c]=n#include<bits/stdc++.h>using namespace std;int main(){ int SNum[10]={6,2,5,5,4,5,6,3,7,6},n,X[1000]; //对于题目要求的A+B=C,易知C最大为987,当然,C最小为2, //每个数字对应的火柴 cin&gt...

2019-05-18 19:08:43 149

原创 洛谷习题P1217回文质数

前前后后修改六两个半小时其实算不上难ac代码#include<bits/stdc++.h>using namespace std;//根据题目的回文数定义,易知在100以内,回文质数只有5 7 11 //所以生成回文数从三位开始 int Num[800];int step=3;int flag(int temp){//判断素数,素数返回这个数 int t=0;...

2019-05-17 15:36:02 278

原创 洛谷习题P1028递推

递推问题必须搞清楚问题的递推公式i1 #12 1 #23 1 #244 2 1 2 1 1 #4 55 2 1 2 1 1 #4 66 3 1 3 1 6 2 1 2 1 1 #6 77 3 1 3 1 7 2 1 2 1 1 #6显然可看出(当然,我第一次花了很久才懂)if...

2019-05-14 20:31:34 162

原创 洛谷习题P1598垂直柱状图

char使用gets(char)string使用str.getline()#include<bits/stdc++.h>using namespace std;int main(){ char alph[26],ALPH; string p1,p2,p3,p4,text; int i,j,pos,count[26],maxtimes; i=0; for(ALP...

2019-05-10 15:51:00 396

原创 洛谷习题P1308 字符串搜索字串

第一次提交的错误代码#include<bits/stdc++.h>using namespace std;int main(){ int i,j,sum=0,flag=0,lenK,lenT; string Keyw;// 关键词打算录入Keyw string Text[100000]; //文章打算录入Text数组,最多有100000个单词, //所以让它有...

2019-05-10 10:13:48 326

原创 洛谷习题P1033字数反转

#include<bits/stdc++.h>using namespace std;void print(char temp[],int l){ int i,j=0; for(i=0;i<l;i++){ if(temp[i]!='0'){ j=i;break; } } for(i=j;i<l;i++)cout<<temp[i];...

2019-05-09 19:34:21 157

原创 结构体typedef

在定义结构体时,结构体中的数据只能定义而不能做其他动作如运算#include<bits/stdc++.h>using namespace std;typedef struct{ char name[10]; float Num1; float Num2; float Num3; float Num4=Num1+Num2+Num3; //这样定义结构体中的数据是完全错误...

2019-05-07 16:08:43 1747

原创 北理上机题(数据结构储存类型描述)

建立一个学生信息系统,输入学生信息,输出挂科同学的信息,再按照平均成绩的高低排序输出输入样例5zhaoyi 70 80 90qianer 65 32 77sunsan 100 55 68lisi 86 77 90wanggu 100 59 66输出样例*[qianer] 65 32 77*[sunsan] 100 55 68*[wangwu] 100 59 66l...

2019-05-07 15:57:00 253

原创 洛谷习题P1055 ISBN字符输入

注意:ASCII的编码字符 对应的ASCII码(10进制)‘0’ 48‘1’ 49‘2’ 50‘3’ 51…‘8’ 56‘9’ 57#include<bits/stdc++.h>//c++的万用头文件 using namespace std;int main(){ int i,j=0,Num[10],SUM=0,mod; char ISBN[13],isb...

2019-05-03 13:55:08 229

原创 字符数组的输入输出

#include<bits/stdc++.h>//c++的万用头文件 using namespace std;int main(){ char A[13]; gets(A);//这里输入为0-670-82162-4 puts(A);}

2019-05-03 13:12:31 2147

原创 数组初始化为0

#include<iostream>using namespace std;int a[10];int main(){ int i; for(i=0;i<10;i++){ cout<<a[i]<<endl; }}输出为0000000000--------------------------------...

2019-05-02 15:07:30 3360

原创 洛谷c++习题 P1008三连击

洛谷c++习题 P1008三连击#include<iostream>using namespace std;int main(){ int a[1000],i,j,k,b1[206],b2[206],b3[206],b=0; for(i=0;i<1000;i++){ a[i]=i; } for(i=123;i<334;i++){ for(j=2...

2019-04-24 19:32:00 310

原创 tensorflow个人学习笔记(一)

tensorflow个人学习笔记模块化神经网络的基本结构一、生成数据集opt4_8_generateds.py#coding:utf-8#模块化神经网络的结构分为三部分,第一部分生成模拟数据集,在实际应用中,应该是整理数据集#生成模拟数据集import numpy as np #引入np模块import matplotlib.pyplot as plt #引入p...

2018-09-01 13:56:37 511

空空如也

空空如也

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

TA关注的人

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