ZJU-PAT 1050

PAT练习题概览 PAT(pat.zju.edu.cn)是一个面向C/C++程序的Online Judge系统。相比ZOJ,HDOJ,POJ等ACM题库,PAT的题目非常基础,对于数据结构、算法的入门是比较有助益的。 本文按照自己的认识,给PAT advanced level做出了分类。由于很多题目实际上兼顾有多种解法和思路,我给每道题打上了tag,来应对分类的独占性局限,供大家参考。 简单题 这 阅读详情
#include<iostream>
#include<string>
using namespace std;

/*
Sample Input:
They are students.
aeiou
Sample Output:
Thy r stdnts.
*/

bool myhash[150];

string s1,s2;

void run()
{
  getline(cin,s2);

  int i;
  string s="";
  int len=s1.size();
  int len2=s2.size();

  for(i=0;i<150;i++) myhash[i]=0;

  for(i=0;i<len2;i++) 
  {
    myhash[s2[i]]=1;
  }
  
  
  for(i=0;i<len;i++)
  {
    if(myhash[s1[i]]==0) s+=s1[i];
  }
  cout<<s<<endl;
}

int main()
{
  while(getline(cin,s1)) run();
  return 0;
}

PAT 1050:String Subtraction

利用ascii表的哈希去重

浙大PAT水题型简单分析归类 PAT(pat.zju.edu.cn)是一个面向C/C++程序的Online Judge系统。相比ZOJ,HDOJ,POJ等ACM题库,PAT的题目非常基础,对于数据结构、算法的入门是比较有助益的。 本文按照自己的认识,给PAT advanced level做出了分类。由于很多题目实际上兼顾有多种解法和思路,我给每道题打上了tag,来应对分类的独占性局限,供大家参考。 简单题 这类题几乎不需 阅读详情

相关推荐

从Transformer到Mamba:显著性检测领域的计算效率革命(Samba框架深度解析)

本文深入解析了Samba框架在显著性目标检测(Salient Object Detection)领域的创新应用,通过结合Mamba架构的优势,实现了计算效率的革命性提升。Samba框架采用显著性引导的Mamba模块(SGMB)和上下文感知上采样(CAU),有效解决了传统CNN和Transformer的局限性,同时在RGB-D等多模态任务中展现出卓越性能。

mmm90的博客 557

django.db.utils.OperationalError: 1050解决方案

摘要: 执行manage.py migrate解决报错: django.db.utils.OperationalError: (1050, "Table '表名' already exists)解决方法 正在用django1.7初始化一个项目,数据库表字段变更比较频繁。models.py表类中添加了一个class类后。执行manage.py makemigrations 未提示错误信息,

NeverSayNever 2万+

ThinkPad T14 Gen 2与T14P系列对比

表格您的需求推荐机型日常办公、出差、文档处理、视频会议✅(够用、轻便、便宜)视频剪辑、3D建模、编程编译、AI训练、高色准设计✅(性能强、屏幕好、扩展佳)想要未来 5 年不换机✅T14p预算低于 5000 元✅T14 Gen 2(或考虑 T14 Gen 3/4)T14p 2025 款 ≠ 小改款,而是架构级升级它从“高性能笔记本”进化为“AI 移动工作站”,核心差异在于NPU + Ultra 平台 + 全面屏显 + 超长续航。如果您从事AI 开发、视频创作、工程仿真、多任务编程。

tecoes的博客 2738

django报1050, "Table 'django_content_type' already exists"

分析:这个报错的原因是,已经做过migration了,但django_migrations中并没有记录! 导出数据库时,这张表居然为空,导不出来,于是就有了这个问题。解决:手动创建django_migrations表的记录,哪些有做过migration的,这张表就添加记录。网上有人用python manage.py migrate --fake-initial来解决,但我看不行!不知道从什么时候开

Power of technology will free your body and spirit 1万+

Goose开源程序本地机上 AI 代理,能够从头到尾自动执行复杂的开发任务。Goose 不仅可以提供代码建议,还可以自主构建整个项目、编写和执行代码、调试故障、编排工作流程以及与外部 API 交互

Goose开源程序 是您的本机上 AI 代理,能够从头到尾自动执行复杂的开发任务。Goose 不仅可以提供代码建议,还可以自主构建整个项目、编写和执行代码、调试故障、编排工作流程以及与外部 API 交互。无论您是在构建想法原型、优化现有代码,还是管理复杂的工程管道,goose 都能适应您的工作流程并精确执行任务。

struggle2025的博客 2041

手把手教你逆向分析某里系bx-ua参数(以225版本为例)

本文详细解析了某里系应用bx-ua参数的逆向工程实战方法,重点拆解其三层加密体系(二进制加密、字符替换和Base64编码)。通过工具链配置和实战案例,帮助开发者掌握逆向分析技巧,适用于合法合规的安全研究和加密技术评估场景。

weixin_33220360的博客 412

EASY_ZJU_PAT_ADVANCED LEVEL 1050 高效输入含有空格的字符串 高效删除字符串中的字符

1050. String Subtraction (20) 时间限制 10 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard Given two strings S1 and S2, S = S1 - S2 is defined to be the

高析的博客 991

【深大计算机网络】实验三 可靠传输机制 实验报告 附代码

【内附代码】【深大计算机网络】实验三 可靠传输机制 实验报告 附代码

m0_74268508的博客 1654

PAT 1050

题目大意: http://pat.zju.edu.cn/contests/pat-a-practise/1050 思想:ascll码有128个,设置一个vector<int> ascll[128]; 用来记录S1各个字符出现在S1中的位置,标记,遍历输出即可。 1 #include<iostream> 2 #include<vector...

afsvl68886的专栏 103

无限泛化!AI背景文字识别,腾讯文字六宫格

本文介绍了生成大规模文字验证码数据集的方法,通过使用上百种字体和2万+字库,结合随机背景和数十种图像增强技术,生成了2000万+的多样化样本。该方法采用二阶段训练策略,确保模型对字体、形态、形变等具有强泛化能力,可适配腾讯、咸鱼等多种平台的文字验证码识别,包括生僻字和复杂形变情况。生成的模型在多种验证码场景下表现优异,但强调该方法仅用于技术研究,严禁非法用途。

码王吴彦祖的博客 563

详解Xilinx FPGA高速串行收发器GTX/GTP(1)--SerDes和GTX的关系

详解Xilinx FPGA高速串行收发器GTX/GTP(1)--SerDes和GTX的关系

孤独的单刀 4350

PAT1050-String Subtraction

题目地址:http://pat.zju.edu.cn/contests/pat-a-practise/1050 C语言源码: #include #include #define maxsize 10000 char s1[maxsize],s2[maxsize]; int T[maxsize]; int main() { int i,len; gets(s1); gets(s2); f

312

uniapp - 实现PDA扫码枪RFID批量扫描读取示例代码,uni-app APP识别RFID(射频识别)结合硬件设备进行扫描,uniApp调用RFID读写通用方案适配各种设备+完整实例源码教程!

uni-app PDA 读取RFID,基于uniapp开发PDA扫码枪APP:实现RFID批量扫描读取功能,UniApp中的RFID实现,手持机 RFID插件(uni-app集成手持设备rfid插件),uniapp自动识别RFID,uni-app调RFID模块,uni-app RFID识别插件,uniapp读取rfid,uniapp手持设备扫描rfid,uniapp超高频rfid识别,rfid标签识别,uniapp调用RFID读写,uniapp rfid扫码枪,uniapp中如何使用rfid插件,打包上线后

🏆 前端领域优质创作者 1万+

PAT 1050. String Subtraction

题目:http://pat.zju.edu.cn/contests/pat-a-practise/1050 题解: 代码: #include #include #include #include #include #include #include using namespace std; #define MAX 10005 set setx; char a[MAX],b[MAX]; int

Ted's 游乐园 1202

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

深度学习工具包 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")

1050. String Subtraction (20)

简单的考察建立查询表  题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1050 #include #include #include #include #include #include #include #include #include using namespace std; #define MAX 1000 i

孙佰贵的专栏 3013

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

【PAT】1050 String Substraction

怎么样快速的查询时关键,使用暴搜一定会超时的。 题目链接:http://pat.zju.edu.cn/contests/pat-101-103-1-2013-03-10/A A. String Subtraction (20) 时间限制 10 ms 内存限制 32000 kB 代码长度限制 8000 B 判题程序

此去经年 1141

pat advanced 1050

题目:http://pat.zju.edu.cn/contests/pat-a-practise/1050 很坑爹,限时10ms,因为int len = strlen(ch1); for(int i = 0; i写成了for(int i = 0; i 所以一直有两个case TLE。 思路,先把字符串1存起来,字符串2用map或者一个数组关联起来,再遍历字符串1,有字符串2的

x 536

1050. String Subtraction (20)-PAT

1050. String Subtraction (20) 时间限制 10 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard Given two strings S1 and S2, S = S1 - S2 is defined to be the

兵临城下 1133

PAT 题型分类~~

转自http://blog.youkuaiyun.com/biaobiaoqi/article/details/9775517 值得分享~~ PAT(pat.zju.edu.cn)是一个面向C/C++程序的Online Judge系统。相比ZOJ,HDOJ,POJ等ACM题库,PAT的题目非常基础,对于数据结构、算法的入门是比较有助益的。 本文按照自己的认识,给PAT advanced le

神州之光的专栏 1278

浙大PAT水题简单分析 转

浙大PAT水题简单分析 转 (2014-01-25 10:23:19) 转载▼ 标签: it 分类:PAT PAT(pat.zju.edu.cn)是一个面向C/C++程序的OnlineJudge系统。相比ZOJ,HDOJ,POJ等ACM题库,PAT的题目非常基础,对于数据结构、算法的入门是比较有助益的。 本文按照自己的认识,给PAT

0_o_c 846

【PAT】2020年春季考试划水准备贴

1、起因 因为之前NOIP凉了,所以算法竞赛没拿到任何加分加好感项,感觉白敲了三年代码 偶然间看到这个而且感觉挺简单,就试试三位一体有没有用,或者暑假实习,再不济反正把乙考了大学在水甲级和顶级凑一凑考ZJU的Master也挺好 2、报名 大约是因为今年疫情很多考点没开,就选了个最近的,结果发现开发环境不对。。。。 而且说到底是第一次机试,各种小慌张,据说到时候是在拼题上提交(过程可以看到AC...

小哈里的博客 2059

ACM 题目分类

有很多的题目不会做,有时看了别人的解题报告后,自己又不想再写一遍,所以这里就把自己碰到的一些不会做的题目给记录一下,后面如果忘记了,可以再来这里看看。 想法题 PAT http://pat.zju.edu.cn/contests/pat-a-practise/1038 LeetCode http://leetcode.com/onlinejudge#question_11  O(n)

565

ZJU-PAT 1010. Radix (25)

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive

Matrix_Reloaded的专栏 4799
上一篇: ZJU-PAT 1051 Pop Sequence
下一篇: 2013腾讯编程马拉松初赛第0场(3月20日) HDU 4500
Matrix_Reloaded
博客等级 码龄14年 18粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值