#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n,m;
char c[55][55];
scanf("%d%d",&n,&m);
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
cin>>c[i][j];
int r1=0,r2=n-1,c1=0,c2=m-1;
for(r1;r1<=r2;r1++)
{
bool flag=false;
for(int j=c1;j<=c2;j++)
{
if(c[r1][j]=='*')
{
flag=true;
break;
}
}
if(flag)
break;
}
for(r2;r2>=r1;r2--)
{
bool flag=false;
for(int j=c1;j<=c2;j++)
{
if(c[r2][j]=='*')
{
flag=true;
break;
}
}
if(flag)
break;
}
for(c1;c1<=c2;c1++)
{
bool flag=false;
for(int j=r1;j<=r2;j++)
{
if(c[j][c1]=='*')
{
flag=true;
break;
}
}
if(flag)
break;
}
for(c2;c2>=c1;c2--)
{
bool flag=false;
for(int j=r1;j<=r2;j++)
{
if(c[j][c2]=='*')
{
flag=true;
break;
}
}
if(flag)
break;
}
for(int i=r1;i<=r2;i++)
{
for(int j=c1;j<=c2;j++)
printf("%c",c[i][j]);
printf("\n");
}
return 0;
}相关推荐
MATLAB实战:用ARMAX模型搞定电力系统惯量评估(附完整代码)
本文详细介绍了如何利用MATLAB中的ARMAX模型进行电力系统惯量评估,解决新能源占比提高带来的系统惯量下降问题。通过系统辨识技术,从电网运行数据中准确提取惯量参数,并提供完整的代码实现,帮助工程师快速应用于实际工程。
CF 14A Letter
题意 貌似是给定二维字符串组 输出以最外层的*为框框的二维字符串组 找到上下左右的边界即可 #include #include #include using namespace std; int main() { int n,m; char data[50][50]; while(cin>>n>>m) { getchar();
从零到一:基于JasperGold的FPV实战入门与避坑指南
本文详细介绍了基于JasperGold的形式化验证(FPV)实战入门指南,涵盖环境搭建、SVA断言编写、TCL脚本调试等关键步骤。通过实际案例解析,帮助IC设计工程师掌握FPV技术,有效验证RTL设计中的复杂逻辑和corner case,提升验证效率与质量。
Letter - 每天一把CF - 20201108
2020-11-08 dp 180C 1400 题目 原题链接:https://codeforces.com/problemset/problem/180/C 思路 题目大意:给定一个由大写和小写字母组成的字符串,字符串长度不超过1e5,现在有一操作,可以将其中任一字母的大小写改变,问要将这个字符串变成所有大写字母都在小写字母的前面的最小操作数,即先大写字母再小写字母(隐含了说也可以全大写字母或全小写字母)。 思路:唯一一道我可以说tjdl的题目,泪目。 好好看看题目,明显跟具体的字母是什么没有关系,.
OpenWRT二级路由DHCP客户端配置:实现IPv4 WAN自动获取与网段隔离
本文详细讲解了如何将OpenWRT配置为二级路由器,重点在于设置其WAN口为DHCP客户端以自动获取IPv4地址,并修改LAN口网段实现与上级网络的隔离。文章提供了从网络拓扑规划、具体配置步骤到防火墙设置的完整指南,并分享了常见问题排查与避坑经验,帮助用户构建稳定且功能独立的家庭网络环境。
用OpenNI2获取奥比中光Astra Pro及 Astra Pro SM输出的深度图(win,linux arm64 x64平台)
搞了一个奥比中光Astra Pro,想在windows平台,和linux rk3588 上获取深度信息,之前的驱动下载已经不好用了。
题解 CF43B 【Letter】
这道题目,对于C++的选手,考察的是字符串 。字符串的类型定义是string字符串是C语言里没有的。对于这道题,用字符串要比用字符数组要方便。 这一题,由于串里不是字母就是空格,所以我们可以采用统计的方式,开两个数组,用于存储字母A~z。我们又知道字符A的ASCII码是64,字符z的ASCII码是123,所以我们只要开70的数组就可以了。 ...
Keil5调试遇坑记:手把手解决J-Link驱动与固件版本冲突(附老版本驱动包)
本文详细解析了Keil5与J-Link调试器版本冲突问题,特别是当出现'The connected J-Link is defective'警告时的解决方案。通过对比升级固件与降级驱动的优缺点,提供了详细的J-Link驱动降级操作指南,包括获取老版本驱动、替换步骤及常见问题排查,帮助开发者高效解决这一常见调试障碍。
Codeforces 14A A. Letter
题目链接入口 题目描述 Bob 有一张n行m列的矩形图表,他用这张矩形图表画画,想分享给他的哥哥,需要邮寄,邮寄是按照纸张大小来收费的,现在希望能帮助Bob从他的杰作中剪出一个最小成本的矩形,它将包含所有阴影正方形。 输入 输入数据的第一行包含数字 nnn 和 m(1≤ n, m≤ 50)m(1≤ n, m≤ 50)m(1≤ n, m≤ 50),nnn-行数,mmm-Bob表上的列数。下面的nnn行每行包含mmm个字符。字符«.»代表图纸上不带阴影的正方形,«*»-表示带阴影的正方形。保证Bob至少画了一个
手把手教你用高频注入法辨识永磁同步电机电感参数(附MATLAB仿真)
本文详细介绍了高频注入法在永磁同步电机电感参数辨识中的工程实践与MATLAB仿真指南。通过高频信号注入法,无需拆解电机即可在线精确测量Ld和Lq参数,适用于电动汽车驱动和工业伺服等高精度控制场景。文章包含信号设计、硬件实现、解调算法及完整MATLAB仿真模型构建,帮助工程师快速掌握这一关键技术。
Gem5模拟器,详解官网教程Event-driven programming(五)
Gem5模拟器,详解官网教程Event-driven programming、时间调度、如何自定义SimObject
Letters(CF-978C)
Problem Description There are nn dormitories in Berland State University, they are numbered with integers from 1 to n. Each dormitory consists of rooms, there are aiai rooms in i-th dormitory. The r...
MuJoCo 入门教程(一)
在 MuJoCo 仿真中输入自定义数字有三种方法。首先,可在 XML 中定义全局数字字段。它们有一个名称和一个实数值数组。其次,可以通过特定元素的自定义数组来扩展某些模型元素的定义。具体方法是在 XML 元素大小中设置 nuser_XXX 属性。第三,数组 mjData.userdata 不用于任何 MuJoCo 计算。用户可以在这里存储自定义计算的结果;请记住,所有随时间变化的内容都应存储在 mjData 中,而不是 mjModel 中。自定义文本字段可以保存在模型中。
算法成长之路------CF14A Letter
学习目标:算法学习-Day13 题库: 洛谷题库 每天保持发布一篇Java或C算法题解! 题目: 给定一 N×M 规模的矩阵,输出最小的包含所有 * 的矩阵。 输入格式: 一行两个整数, N 和 M 。 然后一个 N×M 大小的矩阵。 输出格式: 输出最小的包含所有 * 的矩阵。 样例 1 : 输入: 6 7 ....... ..***.. ..*.... ..***.. ..*.... ..***.. 输出: *** *.. *** *.. *** 样例 2 : 输入: 3 3 *** *.* *
IEM模型,地表粗糙度模拟
利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
入门好题集(CodeForces)
洛谷: CF14A Letter 题解 CF16A Flag 题解 CF22A Second Order Statistics 题解 CF32B Borze 题解
SIMATIC S7-1200, S7-1500 PID 控制[手册]
SIMATIC S7-1200, S7-1500 PID 控制[手册]
Coding and Paper Letter(五十)
资源整理。春节后第一次更文。 文章目录1 Coding:2 Paper: 1 Coding: 1.Cartographer是一个跨多个平台和传感器配置提供2D和3D实时同步定位和映射(SLAM)的系统。 cartographer 2.社区学习资源,各种学习的QQ群号。 Awesome Learning Communities 3.Jupyter GeoNotebook GeoPySpark的Do...
汉书HE8,好用的汇编代码编写工具
汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大
[CF741D] Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
又是玄学的dsu on tree ,这次还用到了二进制状压的思想...... 用二进制压一个x表示根到节点的链上的字符信息,奇数个为1,偶数个为0。 那么如果x的二进制表示里有不多于一个1,那么重排后就能形成回文串啦。 对于两条链,如果想合并信息,异或一下就OK。 这个题很难想啊...... 简单地说,就是子树里乱搞啦~哈哈哈~ 然后用dsu on tree搞一下,据说用(dfs序+f...
CF741D Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths(dsu on tree)
一棵根为1 的树,每条边上有一个字符(a-v共22种)。 一条简单路径被称为Dokhtar-kosh当且仅当路径上的字符经过重新排序后可以变成一个回文串。 求每个子树中最长的Dokhtar-kosh路径的长度。 如果重排后能构成回文串,那么出现奇数次的字符最多一个。用一个22位二进制数表示每一个字母出现的次数的奇偶,把一个点到根节点的路径的异或值记为$s[u]$,那么就是在子树里找到两个点...
CF 741 D. Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths
D. Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths http://codeforces.com/problemset/problem/741/D 题意: 一棵根为1 的树,每条边上有一个字符(a-v共22种)。 求每个子树内的最长的路径,使得路径上的边按照一定顺序排列后是回文串。 分析: dsu on tre...
CF741DArpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths(DSU on tree)
题目大意: 给定一个以1为根的树,每条路径上都有一个字符(a~v共22个)询问对于每一个子树内最长的路径上字母经排序后可以形成回文串的最长路径多长 解题思路: 假定给你一个字符串,如何判定其经打乱能否形成回文串,那就是说所有字符中最多只有一个能出现奇数次,22个字符,可以用2进制表示每个字符出现的次数奇偶性,1为奇0为偶,那么处理出一个点到根节点路径上的异或和(设为xi),如果两个节...
SAP Cloud Connector连接BTP失败?从401错误到Location ID,一次搞懂所有疑难杂症
本文详细解析了SAP Cloud Connector连接BTP时常见的401错误和Location ID配置问题,提供了从账号冲突到区域选择的全面解决方案。通过日志分析和高级排错技巧,帮助用户快速定位并解决连接故障,确保系统集成稳定可靠。
汽车网红技术之EAVB
汽车网红技术之EAVB
636



被折叠的 条评论
为什么被折叠?



