自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【无标题】

德语查询系统

2022-09-27 08:14:55 106 1

原创 python GUI界面制作(简易的查询界面)

python的tkinter库

2022-09-15 08:47:18 1995 1

原创 【python】错误SyntaxError: invalid syntax的解决方法

最有可能是前文括号没封死

2021-05-31 20:18:40 1275

原创 最长不下降子序列A1045

A1045//最长不下降子序列LIS #include<bits/stdc++.h>using namespace std;const int maxc=210;const int maxn=10010;int hashtable[maxc];int A[maxn],dp[maxn]; int main(){ int n,m,x; scanf("%d%d",&n,&m); memset(hashtable,-1,sizeof(hashtable));//

2021-02-27 12:43:24 67

原创 最大连续子序列求和,动态规划A1007

A1007最大连续子序列求和#include<bits/stdc++.h>using namespace std;const int maxn=10010;int k,a[maxn],dp[maxn],num[maxn];int main(){ scanf("%d",&k); for(int i=0;i<k;i++) { scanf("%d",&a[i]); } dp[0]=a[0];//边界 num[0]=1; for(int i=1;

2021-02-25 22:31:26 47

原创 最短路径A1003 A1030 A1072 A1087

A1003dijkstra#include<bits/stdc++.h>using namespace std;const int maxn=510;const int INF=1000000000;int n,m,c1,c2;int weight[maxn],w[maxn];//weight是点权,w是最大点权之和 int G[maxn][maxn];//边权 int d[maxn],num[maxn];//d记录最短距离,num记录最短路径条数 bool vis[maxn

2021-02-25 20:27:46 41

原创 图的遍历A1034 A1076 A1013

A1034在这里插入代码片

2021-02-21 23:48:35 37

原创 并查集A1107

A1107#include<bits/stdc++.h>using namespace std;const int N=1010;int father[N];//存放父亲结点 int isroot[N]={0};//记录每个结点是否作为根结点 int course[N]={0};//查找x所在集合的根结点 int findfather(int x){ int a=x; while(x!=father[x]){ x=father[x]; } while(a!=fathe

2021-02-20 20:21:18 40

原创 二叉查找树A1043 A1064 A1099 A1066

A1043#include<bits/stdc++.h>using namespace std;struct node{ int data; node *left,*right;};int N,a[1000];int used;vector<int> post;node* makeBST(int cur,int ceil,int floor)//上限,下限{ node* p=new node; used++; p->data=a[cur]; i

2021-02-19 17:08:26 46

原创 树的遍历A1079 A1090 A1094 A1106 A1004

A1079#include<bits/stdc++.h>using namespace std;struct node{ int amount; vector<int> child;};int N;double P,r;node n[100001];double sum=0;void dfs(int cur,double danjia){ if(n[cur].amount){//如果是叶结点 sum+=n[cur].amou

2021-02-17 23:59:03 35

原创 二叉树遍历A1020 A1086 A1102

A1020#include<bits/stdc++.h>using namespace std;struct node{ int data; node* lchild; node* rchild;};int post[31],in[31];int n;//已知后序遍历和中序遍历创建二叉树 node* create(int posl,int posr,int inl,int inr){ if(posl>posr){ return NULL; } node*

2021-02-16 22:03:03 55

原创 DFS A1103 BFS A1091

A1103我不会我是个废物#include<bits/stdc++.h>using namespace std;struct node{ int a[401];//个数最大是400 };int N,P,K;//N是要分解的数,P是指数,K是个数 int power[21];//底数最大是20 vector<node> solves; void dfs(int cur,int restsum,int rest,int idx,node&n)//restsu

2021-02-14 21:35:13 41

原创 关于#include<bits/stdc++.h>头文件的问题

求问各位代码大神,以下这段代码为什么用#include<bits/stdc++.h>就不好使用#include<iostream>就可以bits/stdc++.h不是包括iostream吗#include<bits/stdc++.h>using namespace std;int M,N,L,T;int a[60][1286][128];//最多60层1286行128列 三维数组 int b[60][1286][128]={0};//标记数组是否来过

2021-02-14 21:15:32 2260 5

原创 链表A1032 A1052 A1074 A1097

A1032静态链表//静态链表 #include<bits/stdc++.h>using namespace std;const int maxn=100010;struct NODE{ char data;//数据域 int next;//指针域 bool flag;//结点是否在第一条链表中出现 }node[maxn];int main(){ for(int i=0;i<maxn;i++){ node[i].flag=false;//先把他们都置为fa

2021-02-09 22:56:31 54

原创 stack A1051 queue A1056

A1051#include<bits/stdc++.h>using namespace std;const int maxn=1010;int arr[maxn];//保存题目给定的出栈序列 stack<int> st;//定义栈st,用以存放int型元素 int main(){ int m,n,k; scanf("%d%d%d",&m,&n,&k); while(k--) { //先把用过的栈清空 while(!st.emp

2021-02-09 15:56:54 35

原创 map A1100 A1054 A1071

A1100在这里插入代码片

2021-02-05 21:59:09 43

原创 vector A1039 A1047 set A1063 stringA1060

A1039

2021-02-02 18:22:30 59

原创 大整数运算B1017 A1023 A1024

B1017#include<bits/stdc++.h>using namespace std;struct bign{ int d[1000]; int len; bign(){ memset(d,0,sizeof(d));//数组,首地址,长度,将d数组中的这些位置0 len=0; }};bign change(char str[])//将整数转换为bign { bign a; a.len=strlen(str); for(int i=0;i<a

2021-02-01 14:53:39 56

原创 质因子分解A1059A1096

A1059#include<bits/stdc++.h>using namespace std;//判断一个数是否为素数 bool isprime(int n){ if(n<=1) return false; int sqr=int(sqrt(1.0*n)); for(int i=2;i<=sqr;i++) { if(n%i==0) return false; } return true;}//求素数表 const int maxn=100010;in

2021-02-01 12:52:52 44

原创 5.4素数 B1013 B1007 A1015 A1078

判断一个数是否为素数bool isPrime(int n){ if(n<=1) return false; int sqr=(int)sqrt(1.0*n);//sqrt的参数要求是浮点数 for(int i=2;i<=sqr;i++) { if(n%i==0) return false; } return true; }B1013#include<iostream>#include<vector>using namespa

2021-02-01 10:51:38 39

原创 分数的四则运算A1081 A1088

#include<bits/stdc++.h>using namespace std;//这段函数背下来 ,求最大公约数的long long gcd(long long a,long long b) { return b==0?abs(a):gcd(b,a%b);}int main(){ long long n,a,b,gcdvalue,suma=0,sumb=1; scanf("%lld",&n); for(int i=0;i<n;i++) { scan

2021-01-30 15:19:24 51

原创 A1049 最大公约数与最小公倍数B1008

A1049不会做#include <iostream>using namespace std;int main() { int n, left = 0, right = 0, a = 1, now = 1, ans = 0; scanf("%d", &n); while(n / a) { left = n / (a * 10), now = n / a % 10, right = n % a; if(now == 0) ans

2021-01-30 09:48:49 57

原创 简单数学B1003 A1069 A1104 A1008

B1003#include<iostream>#include<map>using namespace std;int main(){ string s; int n,p=0,t=0; scanf("%d",&n); for(int i=0;i<n;i++) { cin>>s; map<char,int> m; for(int j=0;j<s.size();j++) { m[s[j]]++;

2021-01-29 15:15:12 32

原创 A1093 A1101

A1093不会做#include<iostream>#include<string>using namespace std;int main(){ string s; cin>>s; int result=0,countp=0,countt=0; for(int i=0;i<s.length();i++) { if(s[i]=='T') countt++; } for(int i=0;i<s.length();i++) {

2021-01-28 10:53:29 50

原创 two pointersA1029 A1089

A1029很简单的一道题#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){ int n,m; scanf("%d",&n); vector<int> a(n); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } scanf("%d",&m);

2021-01-28 10:02:37 31

原创 二分A1085 A1010 A1044 A1048二分解法

A1085

2021-01-27 13:24:31 56

原创 贪心A1037 A1067 A1038

A1037#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){ int nc,np; int p=0,q=0,ans=0; scanf("%d",&nc); vector<int> v1(nc); for(int i=0;i<nc;i++) { scanf("%d",&v1[i]); } s

2021-01-23 15:13:57 33

原创 贪心B1023 A1070 A1033

B1023 自己做的#include<iostream>using namespace std;int main(){ int a[10]; for(int i=0;i<10;i++) { scanf("%d",&a[i]); } int t; for(int i=1;i<10;i++) { if(a[i]!=0) { t=i; break; } } printf("%d",t); for(int j=a[0];j&g

2021-01-23 13:28:03 56

原创 散列B1005 A1048

B1005遇到了两个坑:一是他这里提示段错误,那就是hashtable设的值太小或者说他没有放在main函数外二是普通数组进行排序时应该sort(a,a+n,cmp)而不是vector中的sort(a.begin(),b.begin(),cmp)#include<iostream>#include<algorithm>using namespace std;bool cmp(int a,int b){ return a>b;}bool hashtable[

2021-01-22 10:50:20 38

原创 散列B1047 A1041 A1050

B1047//B1047#include<iostream>using namespace std;int main(){ int maxn=1010; int b[maxn]={0}; int n; scanf("%d",&n); int team,member,score; for(int i=0;i<n;i++) { scanf("%d-%d %d",&team,&member,&score); b[team]+=sc

2021-01-20 18:38:01 56

原创 散列A1092 B1042 B1043

A1092柳神的思路,自己完成,,,#include<iostream>#include<vector>using namespace std;int main(){ string a,b; cin>>a>>b; int ans=0; vector<int> book(101); for(int i=0;i<a.length();i++) { book[a[i]]++;//每一个珠子出现的次数 } for(

2021-01-19 15:36:41 42

原创 散列A1084 B1033 B1038

A1084#include<iostream>#include<cctype> using namespace std;//string类不用头文件,只能用cin和cout处理,不能用scanf和printf int main(){ //string::npos表示直到字符串结尾 string s1,s2,ans; cin>>s1>>s2; for(int i=0;i<s1.length();i++) { //当 当前字符串s

2021-01-18 22:02:35 34

原创 排序A1085 A1095

照着柳神写的,好悲催//A1080#include<iostream>#include<algorithm>#include<vector>using namespace std;//quota限额,定额,指标//exceed 超过限制struct node{ int ge,gi,final,rank; vector<int> choice; //每一个学生有三个选择,把它们存在动态数组里 int id;//这里的选择没有初始化后面一定要用r

2021-01-17 16:34:42 34

原创 排序A1083 A1080

A1083这道题是自己做出来的虽然很简单但是很开心啊//A1083#include<iostream>#include<vector>#include<algorithm>using namespace std;struct node{ char name[12],id[12]; int grade;};bool cmp(node a,node b){ //if(a.grade!=b.grade) return a.grade>b.gr

2020-10-20 23:06:41 35

原创 排序A1075

A1075//A1075复习#include<iostream>#include<vector>#include<algorithm>using namespace std;struct node{ int id,total=0,rank,passnum=0;//passnum代表得满分题得个数 vector<int> score; //提交过这道题就把它变为true bool isshown=false;};bool cmp

2020-10-18 19:51:05 27

原创 排序A1025 A1028 A1055

A1025#include<iostream>#include<algorithm>#include<vector> using namespace std;struct node{ long long int number;//序号代码,什么时候用long long int int local,score;//所在的考场是1还是2 int localrank,finalrank;//自己在本考场的排名,自己在所有的排名 };bool cmp

2020-10-16 11:21:27 51

原创 入门篇2算法初步之排序A1062,A1012,A1016复习

A1012不想写

2020-10-05 22:57:21 56

原创 入门篇(2)算法初步之排序 A1062

A1062//A1062#include<iostream>#include<algorithm>#include<vector> using namespace std;struct node{ int num,de,cai;};bool cmp(struct node a,struct node b){ if((a.de+a.cai)!=(b.de+b.cai)) return (a.de+a.cai)>(b.de+b.cai);/

2020-09-26 23:00:27 34

原创 2020-9-25 算法初步-排序

冒泡排序右边放最大的,左边放最小的。第一趟比较,第二趟比较,第三趟比较…//冒泡排序#include<stdio.h>int main(){ int a[10]={3,1,4,5,2};//整个过程执行n-1趟 for(int i=1;i<=4;i++) { for(int j=0;j<5-i;j++) { if(a[j]>a[j+1]){ int temp=a[j]; a[j]=a[j+1]; a[j+1]=tem

2020-09-26 08:30:14 36

原创 A1077

A1077//A1077//每输入一个字符串,就把它逆序过来再比较//首先ans = s;后来每输入的一个字符串,//都和ans比较,如果后面不相同的就把它截取掉~最后输出ans即可//(要逆序输出~所以先将ans倒置reverse一下~)#include<iostream>#include<algorithm>//为了使用reverse函数 using namespace std;int main(){ int n; string ans; scanf(

2020-09-25 10:19:23 32

空空如也

空空如也

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

TA关注的人

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