/*
*
*Problem Description
*对于给定的一个字符串,统计其中数字字符出现的次数。
*
*
*Input
*输入数据有多行,第一行是一个整数n,表示测试实例的个数,后面跟着n行,每行包括一个由字母和数字组成的字符串。
*
*
*Output
*对于每个测试实例,输出该串中数值的个数,每个输出占一行。
*
*
*Sample Input
*2
*asdfasdf123123asdfasdf
*asdf111111111asdfasdfasdf
*
*
*Sample Output
*6
*9
*
*
*Author
*lcy
*
*
*Source
*C语言程序设计练习(三)
*
*
*Recommend
*lcy
*
*/
#include<iostream>
#include<string>
using namespace std;
int cnt;
void numbers_of_string(string s) {
cnt = 0;
for (auto i : s) {
if ('0' <= i && i <= '9') cnt++;
}
cout << cnt << endl;
}
int main() {
int n;
string s;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s;
numbers_of_string(s);
}
system("pause");
return 0;
}
相关推荐
通过python下载西门子技术中心文档
本篇文章纯粹记录如何下载通过python下载西门子技术中心文档,所下载文档完全自己学习使用,非商业用途
1132:数字字符统计
1132: 数字字符统计 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 3651 Solved: 1935 SubmitStatusWeb Board Description 对于给定的一个字符串,统计其中数字字符出现的次数。字符串长度不超过1000. Input 输入数据有多行,第一行是
深度学习的unfold操作
对于彩色图像这样的三维数据,unfold操作会对每个通道分别进行上述的二维展开操作。例如,一个 RGB 图像,在对其进行unfold操作时,红色通道、绿色通道和蓝色通道的数据都会被独立地按照定义的窗口和步长展开,然后将这些展开后的通道数据按照原来的通道顺序组合在一起,形成新的张量。与我们熟悉的卷积类似,unfold也是使用一个特定大小的窗口和步长自左至右、自上至下滑动,不同的是,卷是滑动后与核求乘积(所以取名为卷积),而unfold滑动后不求乘积,是将窗口内的数据展开。
字符串整理
题目描述 输入一个字符串,将字符串中所有非英文字母的字符删除后输出。 输入 多组测试数据,每组输入一个以回车结束的字符串。 输出 将这行字符中所有非英文字母的字符删除后输出 样例输入 I Have 2 MP3. please you declare the variable m_n_DLength10! 样例输出 IHaveMP pleaseyoudeclarethevariablemnDLeng...
Ubuntu安装pytorch3d的最便捷方法【原创】
Ubuntu安装pytorch3d的最便捷方法
深度学习驱动的股票波动率预测:LSTM和Transformer模型的实战解析
股票市场的波动率一直是金融领域关注的焦点之一。波动率预测对于风险管理、期权定价和资产配置至关重要。深度学习模型,如长短时记忆网络(LSTM)和Transformer,已经在时间序列数据分析领域取得了显著的成就。本博客将向您展示如何使用这两种深度学习模型来进行股票波动率预测,提供清晰的思路和相应的Python代码,以帮助您理解和应用这一重要任务。
Problem 2017-字符串统计
题目链接:acm.hdu.edu.cn/showproblem.php?pid=2017 题目描述: Problem Description 对于给定的一个字符串,统计其中数字字符出现的次数。 Input 输入数据有多行,第一行是一个整数n,表示测试实例的个数,后面跟着n行,每行包括一个由字母和数字组成的字符串。 Output 对于每个测试实例,输出该串中数值的个数,每个...
快速傅里叶变换(FFT)的汇编实现在DSP开发中
在数字信号处理(Digital Signal Processing,DSP)开发中,使用汇编语言实现FFT可以进一步提高计算性能和优化系统资源的使用。FFT是一种分治算法,它通过将一个长度为N的离散时间域序列分解为多个长度为N/2的子序列,然后递归地进行计算。开发者可以根据实际需求,结合具体的硬件平台和编译器工具链,对FFT的汇编实现进行优化和定制化。需要注意的是,上述示例代码中只给出了FFT的基本框架,具体的合并操作及其他细节需要根据实际需求进行实现。上述示例代码演示了一个简单的FFT汇编实现。
https://vjudge.net/problem/HDU-2017----字符串统计
#if 0 对于给定的一个字符串,统计其中数字字符出现的次数。 Input 输入数据有多行,第一行是一个整数n,表示测试实例的个数,后面跟着n行,每行包括一个由字母和数字组成的字符串。 Output 对于每个测试实例,输出该串中数值的个数,每个输出占一行。 Sample Input 2 asdfasdf123123asdfasdf asdf111111111asdfasdfasdf Sample...
5、自动化代码结构与运维系统的优化
本文探讨了自动化代码结构与运维系统的优化方法,涵盖审批流程的模块化设计、日志记录与工单系统的集成、通知方式的选择、错误处理的策略以及持续改进的实践。同时,深入分析了运维盲目性问题,通过故障案例揭示了关键指标缺失和日志未充分利用的弊端,提出了开发与运维角色转变的必要性。文章还介绍了如何生成有用的系统指标、建立良好的日志习惯以及实施日志聚合,以提升系统的可观测性和可靠性。最终通过总结和流程图展示了优化措施的核心要点,为构建高效、可靠的运维体系提供了指导。
华为自研 ERP、Oracle EBS 与 SAP 上线时系统配置思路设计差异深度分析
本文对比分析了华为自研ERP、Oracle EBS和SAP S/4HANA三大ERP系统在上线配置思路上的核心差异。从架构设计看,华为采用分布式微服务架构,SAP采用分层服务架构,Oracle采用集中式一体化架构;在模块配置上,华为以业务场景为导向,SAP基于行业模板,Oracle强调模块独立性;数据迁移方面,华为侧重业务规则清洗,SAP注重数据质量监控,Oracle依赖标准化工具;流程适配上,华为系统随流程调整,SAP在框架内优化,Oracle需定制开发;定制开发模式差异明显,华为采用插件化扩展,SAP使
hdu2017 字符串统计
Problem Description 对于给定的一个字符串,统计其中数字字符出现的次数。 Input 输入数据有多行,第一行是一个整数n,表示测试实例的个数,后面跟着n行,每行包括一个由字母和数字组成的字符串。 Output 对于每个测试实例,输出该串中数值的个数,每个输出占一行。 Sample Input 2 asdfasdf123123asd
RK356x U-Boot研究所(命令篇)3.10 bidram与sysmem相关命令的作用
RK356x U-Boot研究所(命令篇)3.10 bidram与sysmem相关命令的作用
hdu_problem_2027_统计元音
/* * *Problem Description *统计每个元音字母在字符串中出现的次数。 * * *Input *输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串。 * * *Output *对于每个测试实例输出5行,格式如下: *a:num1 *e:num2 *i:num3 *o:num4 *u:num5 *多个测试实例之间由一个空行隔开。 * *请特别注意...
RU DOS版、EFI版32bit/64bit BIOS常用工具
DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。
深度学习工具包 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")
HDU - 5688 Problem D
Description 度熊所居住的 D 国,是一个完全尊重人权的国度。以至于这个国家的所有人命名自己的名字都非常奇怪。一个人的名字由若干个字符组成,同样的,这些字符的全排列的结果中的每一个字符串,也都是这个人的名字。例如,如果一个人名字是 ACM,那么 AMC, CAM, MAC, MCA, 等也都是这个人的名字。在这个国家中,没有两个名字相同的人。 度熊想统计这个国家的人口数量,请帮助度熊...
文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况
主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。
hdu - problem 1251 统计难题【字典树】
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 35486 Accepted Submission(s): 13269 Problem Description Ignatius最近遇到一个难题,老
IEM模型,地表粗糙度模拟
利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟
hdu_3819 A and B Problem (字符串)
http://acm.hdu.edu.cn/showproblem.php?pid=3819 分析: 代码: #include #include #include #include using namespace std; #define M 100001 int ans[M]; int main() { //freopen("in.txt","r",stdin);
HDU Problem - 1251 统计难题
HDU Problem - 1251 统计难题
HDU 5688Problem D
Problem D Problem D Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1359 Accepted Submission(s): 799 Problem Description 度熊所居住的 D 国,是一个...
HDU 1251 统计难题
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 69742 Accepted Submission(s): 24131 Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小...
HDU5688 Problem D【字符串排序+MAP】
Problem D Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 820 Accepted Submission(s): 499 Problem Description 度熊所居住的 D 国,是一个完全尊重人权的国度。
hdu5688 Problem D
思路是用map来存储,既然要求重名的条件是全排列,那么就设计一个不考虑字符顺序的散列函数。 最初是设计的用一个map存放各个字符出现的次数,stl容器是可以用!=来比较的,可以直接把它当作key,然后用map统计出现的次数。 map的[]运算符访问到不存在的元素会自动创建,利用了这点。
Modbus报文深度解析:从帧结构到调试实战,避开字节序与CRC的坑
Modbus协议作为工业自动化领域广泛使用的通信标准,其报文结构基于主从请求-响应模型,通过功能码定义操作语义,并依赖CRC校验保障数据完整性。理解RTU与TCP帧的差异、字节序处理及异常响应机制,是确保设备可靠通信的关键。在工业现场,Modbus常用于PLC、传感器、变频器等设备的数据采集与控制,其简单开放的特性降低了实施门槛,但细节处理不当易引发调试难题。本文深入拆解Modbus报文结构,涵盖功能码应用、CRC校验计算、字节序判断及抓包调试技巧,帮助开发者系统掌握协议核心,提升工程实践中的问题排查能力。
HDU 5688 Problem D
Problem Description 度熊所居住的 D 国,是一个完全尊重人权的国度。以至于这个国家的所有人命名自己的名字都非常奇怪。一个人的名字由若干个字符组成,同样的,这些字符的全排列的结果中的每一个字符串,也都是这个人的名字。例如,如果一个人名字是 ACM,那么 AMC, CAM, MAC, MCA, 等也都是这个人的名字。在这个国家中,没有两个名字相同的人。 度熊想统计这个国
HDOJ(HDU) 1860 统计字符
Problem Description 统计一个给定字符串中指定的字符出现的次数Input 测试输入包含若干测试用例,每个测试用例包含2行,第1行为一个长度不超过5的字符串,第2行为一个长度不超过80的字符串。注意这里的字符串包含空格,即空格也可能是要求被统计的字符之一。当读到’#’时输入结束,相应的结果不要输出。Output 对每个测试用例,统计第1行中字符串的每个字符在第2行字符串中出现的
565




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



