HDU 1062 Text Reverse 字符串处理

CocosCreator 面试题(十七)Cocos creator 固定宽度与固定高度的底层原理是什么?Cocos creator是如何做适配的? 通过固定宽度或固定高度的适配方式,可以使游戏在不同屏幕尺寸上保持一定的一致性,确保游戏中的元素的大小和位置相对稳定。具体选择哪种适配方式取决于你的游戏需求和设计考虑。在 Cocos Creator 中,你可以通过设置「设计分辨率」和使用相对坐标和布局方式来实现固定宽度或固定高度的适配。总之,Cocos Creator 提供了多种适配方式和工具,帮助你在不同屏幕尺寸上保持游戏画面的一致性。在 Cocos Creator 中,固定宽度和固定高度是两种常见的适配方式,用于在不同屏幕尺寸上保持游戏画面的一致性。 阅读详情
//注意,本题目虽然是水题但注意不能用串流处理,存在多个空格间隔单词的情况,如果简单的采用串流则会忽视这种情况
//Presentation Error
#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

void run(){
    string s,t;
    getline(cin,s);
    stringstream m(s);

        int cnt=0;
        while(m>>t)
        {
            if(cnt) cout<<" ";
            reverse(t.begin(),t.end());
            cout<<t;
            cnt++;
        }
        cout<<endl;
}

int main()
{
    int T;
    cin>>T;
    cin.get();
    while(T--) run();
    return 0;
}
//Accepted
/*知识点应用
1.vector
2.find
3.reverse
*/

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;


void run()
{
	string s;
	getline(cin,s);
	vector<string> t;

	while(true)
	{
		int j=s.find(' ');
		if(j!=-1)
		{
			t.push_back(s.substr(0,j));
			s=s.substr(j+1);
		}
		else
		{
			t.push_back(s);
			break;
		}
	}

	for(int i=0;i<t.size();i++)
	{
		if(i>0) cout<<" ";

		reverse(t[i].begin(),t[i].end());

		cout<<t[i];
	}
	cout<<endl;
}


int main()
{
	int T;
	cin>>T;
	cin.get();
	for(int i=0;i<T;i++) run();
	return 0;
}


SAP期初库存导入 (1) LSMW 阅读详情

相关推荐

运算放大器测试方法-输入失调电压

由于运放输入回路的不对称性,在输入端将产生一定的误差信号,从而限制运放信号灵敏度。通常用输入失调电压(VOS)、输入失调电流(Ios)和输入偏置电流(IB)表示。运放有四个主要特征:输入失调特征、开环特征、共模特征及输出特征。其放大倍数较大,由于外界的影响,即使运放的输入端产生较小的输入信号,经过放大,在输出端也会产生较大的误差。为能精确测量其性能,一般采用辅助运放进行测试。下面着重讲了运放的主要参数及如何精确测量这些参数。文中DUT代表被测运放,A代表辅助运放。

weixin_46135931的博客 1万+

HDU1062 Text Reverse(简单字符串处理)

思路:将每个被空格隔开的非空格字符串反转输出就可以,注意最后一个反转和读入就可以 技巧:可以借助 getline读入带空格的字符串,可以借助STL的反转函数对string进行反转操作 #include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <string> #include <iomanip> #include <a

YSJ367635984的博客 539

Eplan2022 复制已有的宏文件生成新的原理图宏文件

Eplan2022 新建原理图宏文件

haier123888的博客 1万+

HDU Text Reverse

题目传送门: http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1&sectionid=2&problemid=5 本题策略是使用一个字符数组来保存一行的所有字符,然后倒序输出即可。#include<stdio.h> #include<iostream> #include<string.h> using namespace s

咕嘟咕嘟 536

WVP+ZLM国标平台实战:从设备注册失败到视频播放黑屏,我遇到的5个典型问题与解法

部署WVP+ZLM国标视频平台时,设备注册失败、视频播放黑屏等问题常常让运维人员头疼不已。本文将基于真实运维场景,剖析五个最具代表性的故障案例,提供从网络配置到版本兼容性的全链路解决方案。

weixin_33178839的博客 361

Mixly/Arduino实战:WS2812点阵动态显示自定义图案与汉字

本文手把手教你使用Mixly和Arduino驱动WS2812点阵屏,实现自定义图案与汉字的动态显示。内容涵盖硬件连接、取模软件设置、高效数据处理技巧(巧用Excel)、Mixly图形化编程及Arduino代码解析,并深入探讨动态显示与滚动汉字原理,最后提供常见问题排查与性能优化心得,助你从零开始轻松玩转智能硬件。

weixin_29185199的博客 454

HDU1062——Text Reverse,HDU1063——Exponentiation,HDU1064——Financial Management

控制输出格式,确保以固定小数位(两位)的形式输出平均值。通过逐位相乘、处理进位和调整结果长度来实现。循环,循环 12 次,每次读取一个月的余额并存入。结构体表示的数字的乘积,并将结果存储在第三个。用于累计所有月的余额,初始化为 0。来表示数字,包含数字的数组和长度。用于临时存储每次输入的月余额,计算所有余额的平均值,将总和。程序返回 0 ,表示正常结束。除以 12 ,结果存储在。首先,读取测试用例的数量。的值执行相应次数的操作。输出处理后的结果字符串。定义了两个双精度浮点数。首先定义了一个结构体。

u014114223的博客 1596

Sigrity System Explorer Transient Analysis模式进行瞬态仿真分析操作指导-差分信号

Sigrity System Explorer Transient Analysis模式可以用于瞬态仿真分析,通过搭建简易拓扑用于前仿真分析通道的时域性能,下面搭建一个简易的差分拓扑进行说明,以下图为例,准备好发送接收端的IBIS模型, (ibis_se.ibs,本例发送接收端都使用相同的IBIS模型),以及传输线的S参数模型(welement_se.sp)最上方的图形界面是传输线的模型,本例是一个上下都有参考平面的带状线,右侧的梯形是蚀刻角度,根据W1和W2以及铜厚来确定。

weixin_54787054的博客 440

hdu1062--Text Reverse

所以不能用计算回车的方式来实时输出,应该会死循环。还有就是空格的问题,如果两个单词之间的空格只能有一个的话,显然直接scanf+%s就可以了,但这个题不是…就是最后一行的这个输入后面应该是没有回车的,有人会问没有回车咋输入?额,当然使用文件输入啊喂(#`O′)!我用freopen试了一下之后发现是可以的,最后一行的结尾算做是EOF。短短的一道题我把能犯的错都犯了一遍…这个题有一个输入的问题。

weixin_52205764的博客 267

71.qt quick-可伸展菜单-抽屉栏示例 通用QML界面(一键换肤)

特点: 支持动态添加item、删除item、自适应界面 附带添加删除、展开等动画 同时支持qwidget、qml加载 支持number提示(比如消息数量等) 侧边抽屉栏支持动画伸展 支持换肤、拖拽、最大化等

抵抗时间扭曲,坚持做一件有意义的事 5285

TensorRT - 使用自定义层扩展 TensorRT

TensorRT 支持通过自定义插件扩展功能。开发者可以基于 IPluginV3 接口实现插件类,并通过 IPluginCreatorV3One 创建器类注册到 TensorRT 插件注册表。插件实现需要包含核心、构建和运行时三种能力,并通过静态或动态方式注册。最后可使用 addPluginV3() 将插件实例添加到 TensorRT 网络中。这种方法允许在标准层不满足需求时,使用自定义层扩展模型功能。

1148

hdu——1062Text Reverse(反转函数reverse)

Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 25706    Accepted Submission(s): 9959 Problem Description Igna

GreyWings的博客 581

[cshell]个性化配置你的cshrc/tcshrc

本文介绍了csh/tcsh shell的配置优化方法,主要包括:1. 配置文件管理(全局和个人配置);2. 按键绑定设置(解决远程登录按键问题);3. 提示符个性化(包含颜色配置方案);4. 环境变量设置(如LSCOLORS、CLICOLOR等);5. 安全防护措施(防误删、防覆盖等);6. 实用alias命令集(简化操作、提高效率)。文章提供了详细的配置示例,并建议通过man tcsh获取更多帮助信息。这些配置能显著提升shell使用体验和工作效率。

元直的博客 6113

Text Reverse HDU - 1062 字符串处理,空格切分。

Text Reverse HDU - 1062 Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them. Input The ...

种花家的奋斗兔的博客 789

深度学习工具包 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');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

简单字符串处理 hdu1062 Text Reverse

虽然这个题目一遍AC,但是心里还是忍不住骂了句shit! 花了一个小时,这个题目已经水到一定程度了,但是我却在反转这个操作上含糊不清,并且还是在采用了辅助数组的情况下,关系的理顺都如此之难。 其实我是想到了之前那次保研考试,让给数组里面的数换k位,我也是纠结好久没有写出个所以然,郁闷。 1 #include<stdio.h> 2 #include<string...

weixin_33774883的博客 136

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

hdu 1062 Text Reverse 字符串处理。简单水题

Problem Description Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them. Input The input contains several test cases. The first line of the input i

Lionel 1313

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

hdu 1062 Text Reverse(字符串处理,简单模拟)

Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13435    Accepted Submission(s): 5138 Problem Description Ignatius lik

risker_2013的专栏 1166

HDU 1062 Text Reverse 水题 字符串处理

题意:把一行文本中以空格间隔的单词反向。思路:遇到空格就处理即可。 http://acm.hdu.edu.cn/showproblem.php?pid=1062 /********************************************* Problem : HDU 1062 Author : NMfloat InkTime (c) NM . All R

NM的专栏 461

HDU 1062 Text Reverse(字符串处理)

Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16076    Accepted Submission(s): 6081 Problem Description Ignatius likes t

风尘_浪子 889

【字符串处理+单词分割】HDU-1062 Text Reverse

注解 1、字符串处理。熟练使用scanf,getchar,gets等函数。 2、strlen,strcmp等字符数组的函数,头文件是cstring。 3、从左到右遍历,空格分割,然后倒序输出。 代码 #include <iostream> #include <cstring> using namespace std; int main() { int n;...

zhanggirlzhangboy的博客 176

HDU 1062 Text Reverse(水题,字符串处理)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 解题报告:注意一行的末尾可能是空格,还有记得getchar()吃回车符。 1 #include<cstdio> 2 #include<string.h> 3 #include<iostream> 4 #include<algor...

weixin_30699443的博客 114

HDU 1062.Text Reverse【栈或数组或字符串流】【字符处理】【8月30】

Text Reverse Problem Description Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them.

Mr丶Gao 768

Text Reverse HDU - 1062题解

题目描述 Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them. Input The input contains several tes...

qq_40409416的博客 402

hdu 1062 Text Reverse

hdu  1062  Text Reverse           题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 题目简单易懂,单看输入输出即可。 要注意中间有空格,选好的储存结构/输出方法。 以下是代码: #include #include int main() { int t; scanf("%d\n",&t)

slicer的技术交流栈 925

HDU1062 Text Reverse【水题】

Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34466    Accepted Submission(s): 13535 Problem Description Ignatius likes

海岛Blog 6671

HDU1062(Text Reverse)(堆栈)(耗时有点长)

HDU1062(Text Reverse) 一、首先是自己的做法 1.想法很傻瓜。就是先输入字符串,然后直接在原有的数组中进行处理,找到字符串中各个单词。通过设置flag标志,该元素为空格时flag=0,为字符且不为’\0’时flag=1。设置start与finish表示单词在数组中的起始与终止位置。从而length=finish-start+1。找到该单词位置时即可将该单词利用for循环原地翻转。通过 if ((a[k] != ' ') && (flag == 0)) 判断是否是单词

WZ991130的博客 385
上一篇: Linux系统管理入门(1)
下一篇: HDU 1982 Kaitou Kid - The Phantom Thief (1)
Matrix_Reloaded
博客等级 码龄14年 18粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值