- 加载资源时报错-ERR_CONNECTION_RESET,需要多次请求才能拿到资源的有效解决方案
Mebius1916
前端开发前端javascriptreact.js前端框架typescriptvue.js
初次加载资源时无法正常加载,需要多次刷新、请求才能拿到资源的有效解决方案前言在使用cloudinary进行图片上传并获取图片链接作为用户头像时发现,图片链接网址初次加载会报错:ERR_CONNECTION_RESET必须刷新几次才能获取到,原因可能是cloudinary没有国内的节点,而我用的是在新加坡的节点,所以会导致初次加载的时候被重定向。而这个错误会直接导致用户头像无法加载,因为在img中此
- C# WinForm实现WebService接口进行图片上传下载
诡道荒行
本文还有配套的精品资源,点击获取简介:本文深入介绍了在C#WinForm应用程序中使用WebService接口连接服务器,实现图片的上传和下载功能。通过理解WebService基础,利用WinForm工具创建用户界面,并实现客户端与WebService的连接,我们详细探讨了图片上传与下载的具体步骤,包括文件选择、数据转换、接口调用,以及异常处理和进度显示。同时,还强调了安全性与性能优化的重要性,确
- .NetCore+vue3上传图片 Multipart body length limit 16384 exceeded.
鱼是一只鱼啊
Vue后端.netcore图片上传vue3el-upload
实现目标。点击图片上传头像效果图前端部分图片上传关键代码更换头像上传js部分import{ref,reactive,onMounted}from"vue";import{uploadAvatar}from"../../api/auth";import{ElMessage}from"element-plus";exportdefault{setup(){constfit=ref("cover");c
- Markdown基本语法总结
肉啊肉啊肉
Markdown基本语法总结列表内容一内容二在“-”后输入空格,然后加入需要的标题内容如何引用真理惟一可靠的标准就是永远自相符合。——欧文在引用的内容前加上(>)符号如何修改字体加粗是这样滴,前后各两个星号(x)之间加入内容倾斜是这样滴,前后各一个星号(x)之间加入内容如何插入图片[图片上传失败...(image-53464-1521445017290)]![](加入所需要的图片链接)如何加入链接
- Vue3+elementplus实现图片上传下载(最强实践)
J不A秃V头A
前端vue.js前端javascript
图片上传子组件:实现照片的上传,预览,以及转成以逗号隔开的图片地址,即时监听,并发送消息到父组件。Loading...import{computed,ref,watch}from'vue';import{upload}from'@/api/file'import{ElMessage}from'element-plus'importemitterfrom'@/utils/emitter'//上传文件
- 小程序get,post,图片上传 封装
重案组之虎曹达华
/***commonnetworkmethonds**/constapp=getApp();consthost=app.config.host;consthost_img='https://upload-z2.qiniup.com';//getconstget=(url,params,succ,fail)=>{//letaccess_token=app.globalData.accesstoken
- cordova file 插件选择本地图片遇到中文乱码问题
Gemkey
项目中使用图片上传功能,一直以来都是使用cordova的file插件,之前也没有遇到什么问题,但是今天在测试过程中,测试人员反馈,所有拍照上传图片OK,但是截图就报错。于是在我自己的手机上测试后,发现并没有该问题,所以第一反应是不是手机差异,询问后发现测试用的是vivoX9(心中一万匹草泥马奔腾,又是vivo的。。。遇到N个问题都是OV的手机),借来后连上电脑,debug后发现,在文件上传时报错F
- 那些只有程序员才能看懂的冷笑话,用餐时间请勿点开
一个敲代码的前端妹子
[图片上传失败...(image-f379aa-1526459294222)]0客户被绑,蒙眼,惊问:“想干什么?”对方不语,鞭笞之,客户求饶:“别打,要钱?”又一鞭,“十万够不?”又一鞭,“一百万?”又一鞭。客户崩溃:“你们TMD到底要啥?”▼“要什么?我帮你做项目,写代码的时候也很想知道你TMD到底想要啥!”[图片上传失败...(image-cd1d53-1526459294222)]01记者
- uniapp图片上传,加web core api接收并保存
浮生若森
uni-appjavascriptc#vue.js
Uni-App图片上传加后台webcoreApi前台代码后台WebCoreApi代码Startup.cs中代码啥也不说了直接上代码!!!前台代码//Anhighlightedblockuni.chooseImage({count:1,success:(res)=>{uni.uploadFile({url:'http://localhost:24517/api/Upload/UpImgs',file
- 为什么Java仍旧生机盎然——对“为什么Java正在消亡”的回应
苹果酱0567
面试题汇总与解析springboot后端java中间件开发语言
[图片上传失败...(image-599293-1649288200226)]0.阅读完本文你将会了解Java作为热门语言之一所面临的争议了解Java的生态环境和未来1.前言原文标题:WhyJavaIsPerfectlyAlive——Aresponseto"WhyJavaIsDying"原文地址:https://betterprogramming.pub/why-java-is-perfectly
- HarmonyOS JS实现图片上传后端并调用
Brave!
harmonyos华为
前言鸿蒙中能实现图片上传的方法有很多,调用Java端实现的效果更好。本次是使用纯JS将图片转成base64编码并存储后端,之后转成图片保存调用路径下。正文1.创建鸿蒙JS端空项目2.添加权限"reqPermissions":[{"name":"ohos.permission.DISTRIBUTED_DATASYNC"},{"name":"ohos.permission.GET_NETWORK_IN
- vue3 - element-plus 实现图片上传到服务器及预览、删除功能,支持显示进度条、上传失败错误占位的超好用的图像上传组件(详细运行示例及完整组件源码,一键复制开箱即用)
街尾杂货店&
前端组件与功能(开箱即用)vue3图片上传组件elementplus上传组件vue3饿了么上传组件使用vue3实现图像上传并预览vue3图片上传进度条详细教程
效果图本博客实现了vue3项目中,借助elementplus上传组件,实现二次封装上传组件,支持放大预览、删除、上传进度条、图片回显、上传服务器完整示例源码及详细步骤流程。代码整洁注释详细,直接复制组件源码,稍微改改就行了。准备阶段element-plus提供
- android 竖版图片逆时针90度展示问题
lantern王
前提:在做图片上传和展示的时候发现一个问题,竖版拍摄的图片上传到server然后再通过url展示的时候发现图片逆时针90展示了,但是横版的照片是没有问题的。目前遇到的是这个问题,遇到问题的一瞬间想到的是上传照片前拿到图片的宽高然后通过宽高比判断是横版还是竖版,但是实际操作发现无效,然后想到的是可不可以通过获得图片的旋转角度.、、、/***竖版照片顺时针旋转90度**/publicstaticBit
- PowerBI 中正确计算MTD的去年同期
PowerBI战友联盟
本文来自伙伴从实际案例的问题。在PowerBI中,时间智能计算是一个老生常谈的问题,但在实际中可能会出现各种变种,这就要求我们灵活处理。先来看问题是怎样的:[图片上传失败...(image-6b879-1571722027209)]同样是MTD的去年同期,会出现上下两种情况。请仔细观察后发现,我们需要的是上面这种。原因如下:2019年(当前年)的未来月份还没到来,不应该进行计算对比。2019年10
- ASP.NET使用FileUpLoad控件实现图片上传并显示
pcdd
.NETasp.net
后端代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.IO;namespaceex{publicpartialclassWebForm1:System.Web.UI.
- 【Redis 系列】redis 学习十三,Redis 常问简单面试题
阿兵云原生
咱们一起来看看redis常问常用的面试题Redis是个啥?http://www.redis.cn/redis中文网给了很明确且清晰的定义[图片上传失败...(image-ff92fa-1650460734395)]Redis是一个开源(BSD许可)的,内存中的数据结构存储系统Redis可以用作数据库、缓存和消息中间件支持的数据结构有8种字符串(strings),散列(hashes),列表(list
- Mac如何共享文件夹
HaruHappy
在创建共享文件夹之前,我们需要先创建一个用于访问共享文件夹的普通用户。首先点击桌面左上角的黑色苹果图标,然后选择系统偏好设置选项。[图片上传失败...(image-e6c5c4-1554261982777)]2在系统偏好设置的右下角可以看到有个用户和群组,双击这个图标,打开用户和群组设置。[图片上传失败...(image-b0b1d-1554261982777)]3在用户和群组设置里,我们看到默认
- uniapp - H5和微信小程序上传 base64 图片
Rattenking
uniappuni-app微信小程序notepad++
1.前言在做订单评论的时候,需要图片上传,开始使用的FormData上传,但是后端一直获取不到上传的file,由于之前是使用taro开发的H5和微信小程序,所以对uniapp开发不是很熟悉,使用了创建input标签,然后设置属性,来获取图片,最后提交上传。结果发现还是提交不成功,最后发现在taro那边使用的将图片转换为base64,然后再提交上传,就按照这个思路实现。2.H5将选择图片转base6
- Mongodb 使用
liuchungui
安装我这是Mac系统,直接选择brew安装就行了brewinstallmongodb[图片上传中...(image-20190601111727872.png-b280ab-1559898653894-0)]然后运行mongod不过,上面运行是在前台,当关闭终端后就会停止。可以通过设置配置文件,使其保持在后台运行。mongod--dbpath=/data/db--logpath=/usr/loca
- uniapp上传图片跨域报错解决方案
Champagne_7
uni-appphpjavascriptvue
项目场景:用uniapp做图片上传的时候出现了跨域问题前端:uniapp后端:thinkphp问题描述AccesstoXMLHttpRequestat'xxxx'fromorigin'http://localhost:8080'hasbeenblockedbyCORSpolicy:Responsetopreflightrequestdoesn'tpassaccesscontrolcheck:Red
- 不用form表单ajax上传图片(单个图片上传实例)及回显
焱墩
前端
一、html代码段(这里无css样式)上传文件上传二、js(jquery)代码段$(function(){functionhideup(){$("#hidupload").click();},functionupchange(){$("#hidimg").prop("src",URL.createObjectURL($("#hidupload")[0].files[0]));}functionup
- 【编程入门】应用市场(Java版)
蓝不蓝编程
背景前面已输出多个系列:《十余种编程语言做个计算器》《十余种编程语言写2048小游戏》《17种编程语言+10种排序算法》《十余种编程语言写博客系统》《十余种编程语言写云笔记》《N种编程语言做个记事本》目标为编程初学者打造入门学习项目,使用各种主流编程语言来实现。[图片上传失败...(image-af9b3a-1677333595958)]左侧为前端版本:安卓、iOS、鸿蒙、Flutter、Vue、
- uniapp之生成Android签名证书并云打包发布
小李不小
uniapp之生成Android签名证书并云打包发布[图片上传失败...(image-3ec404-1677312555271)]泪滴在琴上关注IP属地:陕西
- SQL server创建数据库
Dust_SongYunfei
一.图形化界面创建数据库1.启动SQLServerManagementStudio,并连接到SQLServer2012中的数据库,在“对象资源管理器”中展开“数据库”节点。2.鼠标右键单击选择"新建数据库"在这里插入图片描述3.数据库的默认所有者为“sa”,选择数据文件和日志文件的路径,点击确定后在这里插入图片描述在这里插入图片描述[图片上传失败...(image-91b35f-158166658
- thinkphp6配置阿里云上传图片
bug别找我
#php阿里云php服务器
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录前言一、安装二、配置阿里云三、接口实现前言提示:这里可以添加本文要记录的大概内容:在thinkphp6中编写上传图片接口并将图片上传到阿里云提示:以下是本篇文章正文内容,下面案例可供参考一、安装在终端打开项目根目录,使用composer进行安装composerrequirealiyuncs/oss-sdk-php二、配置阿里云
- vue 2.0+element ui 使用el-upload图片上传
TJJ.yaml
程序员vuevue.jsui前端vue
el-upload标签上传图片有两种方式:1、上传图片到服务器上,在数据库中存一个url;(以后迁环境的时候,必须将指定的文件夹一起迁移,比较繁琐2、将图片转为base64形势存放到数据库中;(较低一点很方便)两者在前端img标签中使用src,都可将图片展示出**下面介绍的是第二种方法**使用el-upload将图片加载成Base64格式,通过form统一上传给后端1、创建通用componentI
- Springboot打成jar包,图片上传失败
留在彼此的身边
jarspringbootjava
一开始我是放在resource下的,后来打包进行部署的时候,发现访问不了。我就知道是以前的问题。打成jar包的时候,访问不了jar包下的文件,所以需要和jar包放在同级的目录。@Override//资源映射publicvoidaddResourceHandlers(ResourceHandlerRegistryregistry){//registry.addResourceHandler("/st
- day03_Nginx_图片上传
归暔山
电商项目java
学习目标使用域名访问本地项目Nginx图片上传FastDFS实现图片上传1.使用域名访问本地项目1.1.统一环境我们现在访问页面使用的是:http://localhost:8080有没有什么问题?实际开发中,会有不同的环境:开发环境:自己的电脑测试环境:提供给测试人员使用的环境预发布环境:数据是和生成环境的数据一致,运行最新的项目代码进去测试生产环境:项目最终发布上线的环境如果不同环境使用不同的i
- .NET mvc实现图片上传功能,保存到本地,ftp等地方及获取图片
落叶@Henry
.netmvclayuihtml
1.前端实用layui的上传功能2.后端.net可以实现上传保存到本地,到ftp,甚至是七牛云,我之前有文章提及到。3,获取图片,有时我们可能对图片做权限控制,所以会写一个接口获取图片,实现控制图片的作用获取图片包含从本地获取getImage从http远程获取getImageHttp,从ftp获取getImageFtp源码链接放在文末效果图:获取图片效果图及url路径也可以直接浏览器中直接请求查看
- Django Admin图片上传与缩略图处理
腿长袖子短
我是根据我自己的项目的models字段做的,仅供参考在myApp项目下的models.py文件中添加代码:fromPILimportImageimportosfromttsx.settingsimportMEDIA_ROOT#上传图片重命名要用到的libimportos,datetime,uuid#创建原始图片名称defgenerate_filename(instance,filename):""
- JAVA基础
灵静志远
位运算加载Date字符串池覆盖
一、类的初始化顺序
1 (静态变量,静态代码块)-->(变量,初始化块)--> 构造器
同一括号里的,根据它们在程序中的顺序来决定。上面所述是同一类中。如果是继承的情况,那就在父类到子类交替初始化。
二、String
1 String a = "abc";
JAVA虚拟机首先在字符串池中查找是否已经存在了值为"abc"的对象,根
- keepalived实现redis主从高可用
bylijinnan
redis
方案说明
两台机器(称为A和B),以统一的VIP对外提供服务
1.正常情况下,A和B都启动,B会把A的数据同步过来(B is slave of A)
2.当A挂了后,VIP漂移到B;B的keepalived 通知redis 执行:slaveof no one,由B提供服务
3.当A起来后,VIP不切换,仍在B上面;而A的keepalived 通知redis 执行slaveof B,开始
- java文件操作大全
0624chenhong
java
最近在博客园看到一篇比较全面的文件操作文章,转过来留着。
http://www.cnblogs.com/zhuocheng/archive/2011/12/12/2285290.html
转自http://blog.sina.com.cn/s/blog_4a9f789a0100ik3p.html
一.获得控制台用户输入的信息
&nbs
- android学习任务
不懂事的小屁孩
工作
任务
完成情况 搞清楚带箭头的pupupwindows和不带的使用 已完成 熟练使用pupupwindows和alertdialog,并搞清楚两者的区别 已完成 熟练使用android的线程handler,并敲示例代码 进行中 了解游戏2048的流程,并完成其代码工作 进行中-差几个actionbar 研究一下android的动画效果,写一个实例 已完成 复习fragem
- zoom.js
换个号韩国红果果
oom
它的基于bootstrap 的
https://raw.github.com/twbs/bootstrap/master/js/transition.js transition.js模块引用顺序
<link rel="stylesheet" href="style/zoom.css">
<script src=&q
- 详解Oracle云操作系统Solaris 11.2
蓝儿唯美
Solaris
当Oracle发布Solaris 11时,它将自己的操作系统称为第一个面向云的操作系统。Oracle在发布Solaris 11.2时继续它以云为中心的基调。但是,这些说法没有告诉我们为什么Solaris是配得上云的。幸好,我们不需要等太久。Solaris11.2有4个重要的技术可以在一个有效的云实现中发挥重要作用:OpenStack、内核域、统一存档(UA)和弹性虚拟交换(EVS)。
- spring学习——springmvc(一)
a-john
springMVC
Spring MVC基于模型-视图-控制器(Model-View-Controller,MVC)实现,能够帮助我们构建像Spring框架那样灵活和松耦合的Web应用程序。
1,跟踪Spring MVC的请求
请求的第一站是Spring的DispatcherServlet。与大多数基于Java的Web框架一样,Spring MVC所有的请求都会通过一个前端控制器Servlet。前
- hdu4342 History repeat itself-------多校联合五
aijuans
数论
水题就不多说什么了。
#include<iostream>#include<cstdlib>#include<stdio.h>#define ll __int64using namespace std;int main(){ int t; ll n; scanf("%d",&t); while(t--)
- EJB和javabean的区别
asia007
beanejb
EJB不是一般的JavaBean,EJB是企业级JavaBean,EJB一共分为3种,实体Bean,消息Bean,会话Bean,书写EJB是需要遵循一定的规范的,具体规范你可以参考相关的资料.另外,要运行EJB,你需要相应的EJB容器,比如Weblogic,Jboss等,而JavaBean不需要,只需要安装Tomcat就可以了
1.EJB用于服务端应用开发, 而JavaBeans
- Struts的action和Result总结
百合不是茶
strutsAction配置Result配置
一:Action的配置详解:
下面是一个Struts中一个空的Struts.xml的配置文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
&quo
- 如何带好自已的团队
bijian1013
项目管理团队管理团队
在网上看到博客"
怎么才能让团队成员好好干活"的评论,觉得写的比较好。 原文如下: 我做团队管理有几年了吧,我和你分享一下我认为带好团队的几点:
1.诚信
对团队内成员,无论是技术研究、交流、问题探讨,要尽可能的保持一种诚信的态度,用心去做好,你的团队会感觉得到。 2.努力提
- Java代码混淆工具
sunjing
ProGuard
Open Source Obfuscators
ProGuard
http://java-source.net/open-source/obfuscators/proguardProGuard is a free Java class file shrinker and obfuscator. It can detect and remove unused classes, fields, m
- 【Redis三】基于Redis sentinel的自动failover主从复制
bit1129
redis
在第二篇中使用2.8.17搭建了主从复制,但是它存在Master单点问题,为了解决这个问题,Redis从2.6开始引入sentinel,用于监控和管理Redis的主从复制环境,进行自动failover,即Master挂了后,sentinel自动从从服务器选出一个Master使主从复制集群仍然可以工作,如果Master醒来再次加入集群,只能以从服务器的形式工作。
什么是Sentine
- 使用代理实现Hibernate Dao层自动事务
白糖_
DAOspringAOP框架Hibernate
都说spring利用AOP实现自动事务处理机制非常好,但在只有hibernate这个框架情况下,我们开启session、管理事务就往往很麻烦。
public void save(Object obj){
Session session = this.getSession();
Transaction tran = session.beginTransaction();
try
- maven3实战读书笔记
braveCS
maven3
Maven简介
是什么?
Is a software project management and comprehension tool.项目管理工具
是基于POM概念(工程对象模型)
[设计重复、编码重复、文档重复、构建重复,maven最大化消除了构建的重复]
[与XP:简单、交流与反馈;测试驱动开发、十分钟构建、持续集成、富有信息的工作区]
功能:
- 编程之美-子数组的最大乘积
bylijinnan
编程之美
public class MaxProduct {
/**
* 编程之美 子数组的最大乘积
* 题目: 给定一个长度为N的整数数组,只允许使用乘法,不能用除法,计算任意N-1个数的组合中乘积中最大的一组,并写出算法的时间复杂度。
* 以下程序对应书上两种方法,求得“乘积中最大的一组”的乘积——都是有溢出的可能的。
* 但按题目的意思,是要求得这个子数组,而不
- 读书笔记-2
chengxuyuancsdn
读书笔记
1、反射
2、oracle年-月-日 时-分-秒
3、oracle创建有参、无参函数
4、oracle行转列
5、Struts2拦截器
6、Filter过滤器(web.xml)
1、反射
(1)检查类的结构
在java.lang.reflect包里有3个类Field,Method,Constructor分别用于描述类的域、方法和构造器。
2、oracle年月日时分秒
s
- [求学与房地产]慎重选择IT培训学校
comsci
it
关于培训学校的教学和教师的问题,我们就不讨论了,我主要关心的是这个问题
培训学校的教学楼和宿舍的环境和稳定性问题
我们大家都知道,房子是一个比较昂贵的东西,特别是那种能够当教室的房子...
&nb
- RMAN配置中通道(CHANNEL)相关参数 PARALLELISM 、FILESPERSET的关系
daizj
oraclermanfilespersetPARALLELISM
RMAN配置中通道(CHANNEL)相关参数 PARALLELISM 、FILESPERSET的关系 转
PARALLELISM ---
我们还可以通过parallelism参数来指定同时"自动"创建多少个通道:
RMAN > configure device type disk parallelism 3 ;
表示启动三个通道,可以加快备份恢复的速度。
- 简单排序:冒泡排序
dieslrae
冒泡排序
public void bubbleSort(int[] array){
for(int i=1;i<array.length;i++){
for(int k=0;k<array.length-i;k++){
if(array[k] > array[k+1]){
- 初二上学期难记单词三
dcj3sjt126com
sciet
concert 音乐会
tonight 今晚
famous 有名的;著名的
song 歌曲
thousand 千
accident 事故;灾难
careless 粗心的,大意的
break 折断;断裂;破碎
heart 心(脏)
happen 偶尔发生,碰巧
tourist 旅游者;观光者
science (自然)科学
marry 结婚
subject 题目;
- I.安装Memcahce 1. 安装依赖包libevent Memcache需要安装libevent,所以安装前可能需要执行 Shell代码 收藏代码
dcj3sjt126com
redis
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
前面3步应该没有问题,主要的问题是执行make的时候,出现了异常。
异常一:
make[2]: cc: Command not found
异常原因:没有安装g
- 并发容器
shuizhaosi888
并发容器
通过并发容器来改善同步容器的性能,同步容器将所有对容器状态的访问都串行化,来实现线程安全,这种方式严重降低并发性,当多个线程访问时,吞吐量严重降低。
并发容器ConcurrentHashMap
替代同步基于散列的Map,通过Lock控制。
&nb
- Spring Security(12)——Remember-Me功能
234390216
Spring SecurityRemember Me记住我
Remember-Me功能
目录
1.1 概述
1.2 基于简单加密token的方法
1.3 基于持久化token的方法
1.4 Remember-Me相关接口和实现
- 位运算
焦志广
位运算
一、位运算符C语言提供了六种位运算符:
& 按位与
| 按位或
^ 按位异或
~ 取反
<< 左移
>> 右移
1. 按位与运算 按位与运算符"&"是双目运算符。其功能是参与运算的两数各对应的二进位相与。只有对应的两个二进位均为1时,结果位才为1 ,否则为0。参与运算的数以补码方式出现。
例如:9&am
- nodejs 数据库连接 mongodb mysql
liguangsong
mongodbmysqlnode数据库连接
1.mysql 连接
package.json中dependencies加入
"mysql":"~2.7.0"
执行 npm install
在config 下创建文件 database.js
- java动态编译
olive6615
javaHotSpotjvm动态编译
在HotSpot虚拟机中,有两个技术是至关重要的,即动态编译(Dynamic compilation)和Profiling。
HotSpot是如何动态编译Javad的bytecode呢?Java bytecode是以解释方式被load到虚拟机的。HotSpot里有一个运行监视器,即Profile Monitor,专门监视
- Storm0.9.5的集群部署配置优化
roadrunners
优化storm.yaml
nimbus结点配置(storm.yaml)信息:
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional inf
- 101个MySQL 的调节和优化的提示
tomcat_oracle
mysql
1. 拥有足够的物理内存来把整个InnoDB文件加载到内存中——在内存中访问文件时的速度要比在硬盘中访问时快的多。 2. 不惜一切代价避免使用Swap交换分区 – 交换时是从硬盘读取的,它的速度很慢。 3. 使用电池供电的RAM(注:RAM即随机存储器)。 4. 使用高级的RAID(注:Redundant Arrays of Inexpensive Disks,即磁盘阵列
- zoj 3829 Known Notation(贪心)
阿尔萨斯
ZOJ
题目链接:zoj 3829 Known Notation
题目大意:给定一个不完整的后缀表达式,要求有2种不同操作,用尽量少的操作使得表达式完整。
解题思路:贪心,数字的个数要要保证比∗的个数多1,不够的话优先补在开头是最优的。然后遍历一遍字符串,碰到数字+1,碰到∗-1,保证数字的个数大于等1,如果不够减的话,可以和最后面的一个数字交换位置(用栈维护十分方便),因为添加和交换代价都是1