自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 实现性别选择及修改

<el-form-item label="性别" prop="sex" th:href="${emp.getsex()}"> <el-radio-group v-model="editForm.sex"> <el-radio :label="1">男</el-radio> <el-radio :label="0">女</el-radio> </el-radi

2021-11-09 19:30:04 836

原创 第5关:删数问题

任务描述有一个长度为n(n <= 240)的正整数,从中取出s(s < n)个数,使剩余的数保持原来的次序不变,求这个正整数经过删数之后最小是多少。#include<stdio.h>using namespace std;int t=0;int a[1000],b[1000];int x=0;int main(){ int n,m; scanf("%d %d",&n,&m); while(n) { a[t++]=n%10; n/=1

2021-04-25 08:24:03 742 3

原创 第4关:会场安排

任务描述  假设要在足够多的会场里安排一批活动,并希望使用尽可能少的会场。设计一个有效的贪心算法进行安排。(这个问题实际上是著名的图着色问题。若将每一个活动作为图的一个顶点,不相容活动间用边相连。使相邻顶点着有不同颜色的最小着色数,相应于要找的最小会场数。) #include<stdio.h>using namespace std;int ans=0;int a[1000];struct node{ int st; int end;}q[1000];int main(

2021-04-25 08:22:22 178

原创 第3关:背包问题

任务描述现在有很多物品(它们是可以分割的),每个物品有多个,我们知道它们每个物品的单位重量的价值v和重量w(1<=v,w<=10);如果给你一个背包它能容纳的重量为m(10<=m<=20),你所要做的就是把物品装到背包里,使背包里的物品的价值总和最大。#include<stdio.h>struct node{ int a; int b;}q[1000];int main(){ int n,weight,ans=0; scanf("%d %d",&

2021-04-25 08:21:03 388

原创 第2关:最优装载问题

任务描述有一天,海盗截获了一艘装满各种各样古董的货船,每一件古董都价值连城,一但打碎就失去了价值,虽然海盗船足够大,但载重量为C,每件古董的重量为Wi,海盗们如何把尽量多的宝贝装上海盗船呢? #include<stdio.h>int w[100005];int n,weight; int main(){ scanf("%d %d",&n,&weight); for(int i=0;i<n;i++) { scanf("%d",&w[i]);

2021-04-25 08:18:43 518

原创 动态规划实验(2)

第4关:最长单调子序列#include<stdio.h>#include<string.h>int n;struct node{ int len; int a; int last;}q[1005],max,temp;int b[1005];int main(){ max.len=-1; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&q[i].a); q[i].

2021-04-16 16:04:57 91

原创 动态规划实验(1)

第1关:编程实现矩阵连乘问题的求解 #include<stdio.h> int main(){ int n,num=0,temp=0,mmin=1e9; int a[100][100];//记录最小乘次数 //求a[1][n]; int p[100][3] ;//记录矩阵维度 scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d %d",&p[i][1],&p[i][2]); }

2021-04-16 16:02:36 151

原创 2020-4-5穿越雷区(bfs)

穿越雷区(bfs)```cpp#include<bits/stdc++.h>using namespace std;int n,x,y;int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}};int vis[111][111]={0};char maze[111][111];struct node{ int x; int y; string fu;// int step;};node q[1000];bool judge(node

2021-04-05 16:25:42 153

原创 hdu 1242 rescue bfs+优先队列

#include<iostream>#include<cstdio>#include<cstring>#include<queue>using namespace std;int vis[205][205];char mp[205][205];int dir[4][2]={1,0,-1,0,0,1,0,-1};int sx,sy,ex...

2020-04-21 10:32:44 138

原创 hdu 1548 A strange lift

#include <iostream>#include <stdio.h>#include <memory.h>#include <queue>using namespace std;int n,a,b,t,step,flag;int k[201],vis[201]={0};struct node{ int x; int step...

2020-04-13 23:06:39 106

原创 用指针将数组倒序

#include <iostream>using namespace std;void Reverse(int *start,int *end){ int n=(end-start)+1,t; n=n/2; while(n--) { t=*start; *start=*end; *end=t; start++; end--; }...

2020-04-11 13:13:09 2180

原创 L2-003 月饼 (25分)

#include<bits/stdc++.h>using namespace std;struct node{ double a,b,c; double m;}q[1005];int com(node x,node y){ return x.c>y.c;}int main(){ int n; double d,t; double num; cin&g...

2020-04-03 22:33:26 132

原创 Cow Line(队列)

#include <bits/stdc++.h>using namespace std;int main(){ int n; deque<int> q; scanf("%d\n",&n); char c1,c2; int m=0; for(int j=1;j<=n;j++) { scanf("%c %c",&c1,&c2...

2020-03-24 21:59:32 257

原创 寻找子串(字典序)

#include<bits/stdc++.h>using namespace std;int main(){ string s,mmax="a",temp; cin>>s; for(int i=0;i<s.length();i++) { temp=""; for(int j=i;j<s.length();j++...

2020-03-23 21:40:33 261

原创 L1-039 古风排版 (20分)

/*1.注意读入时吃掉空格2.字符串长度不够n*m时记得空格补齐,resize*/#include <bits/stdc++.h>using namespace std;{ int n,m,temp=0; char a[200][200]; string ch; int main() cin>>n; getchar(); getline(cin,c...

2020-03-18 22:26:26 140

原创 鞍点问题(阔能超时)

#include <stdio.h>int main(){ int n,m,flag=0,x,i,j; int a[15][15],temp[15]={-1}; scanf("%d %d",&n,&m); for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",&a[i][j])...

2020-03-17 22:46:25 85

原创 用递归法将一个整数n转换成字符串。例如,输入n为483,输出字符串 4 8 3,每个数字后面接一个空格用于隔开字符。

#include <stdio.h>int solve(int n){ int temp=n%10; n/=10; if(n) solve(n); if(n) printf(" %d", temp); else printf("%d", temp);}int main(){ int n; scanf("%d",&n); solv...

2020-03-16 21:51:43 13500 4

空空如也

空空如也

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

TA关注的人

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