PATA1023_大整数运算(难度:⭐️⭐️)

视频异常检测 5 大经典数据集实战对比:UCSD Ped2 vs CUHK Avenue vs Street Scene 本文深入对比分析了视频异常检测领域的五大经典数据集,包括UCSD Ped2、CUHK Avenue和Street Scene等,从场景复杂度、异常类型和标注质量等多维度进行实战评估。通过详细的数据集特性解析和计算效率测试,为研究者和工程师提供选型指导,帮助优化算法在智能监控和安防领域的应用效果。 阅读详情

如果把这个题做好了,那么下一个题加法部分可以直接c + v。

因为我是倒着做的,所以我用的是1024的😁


#include <bits/stdc++.h>
using namespace std;
string Add (string a, string b) {
    int flag = 0;
    for (int i = a.size() - 1; i >= 0; i--) {
        int u = a[i] - '0', v = b[i] - '0';
        // cout << u << "  " << v << endl;
        if (u + v + flag > 9) {
            a[i] = '0' + (u + v + flag) % 10;
            flag = 1;
            continue;
        }
        a[i] = '0' + (u + v + flag) % 10;
        flag = 0;
        // cout << a << endl;
    }
    if (flag == 1) a.insert(0, "1");
    return a;
}
int main() {
    unordered_map<char, int> m1, m2;
    string s, a;
    int flag = 0;
    cin >> s;
    a = Add (s, s);
    if (a.size() != s.size()) {
        printf ("No\n%s", a.c_str());
        return 0;
    }
    for (int i = 0; i < a.size(); i++) m1[a[i]]++;
    for (int i = 0; i < s.size(); i++) m2[s[i]]++;
    for (auto it : m1) {
        if (m2[it.first] != it.second) {
            flag = 1;
            break;
        }
    }
    if (flag == 0) printf ("Yes\n%s", a.c_str());
    else printf ("No\n%s", a.c_str());
}

【ORB_SLAM系列4】—— 一文搞定如何在Ubuntu20.04中安装运行ORB_SLAM3(包含ROS版本和非ROS版本) ORB-SLAM3是一款基于特征点的实时单目SLAM系统,是SLAM领域的研究热点之一。它的核心算法是结合了ORB特征点提取和描述子匹配、单目RGB相机的深度估计、运动估计和地图优化等步骤,能够在实时性和精度之间取得平衡,适用于各种环境下的定位和建图任务。在各种应用领域都有广泛的应用。本教程主要是介绍了关于在ubuntu20.04中运行ORB_SLAM3的所有依赖的库的安装过程,和所遇到的一些报错的解决方法。有什么问题,可以评论区里面交流讨论 阅读详情

相关推荐

Eigen 直线拟合/曲线拟合/圆拟合/椭圆拟合

使用Eigen库进行直线拟合是数据分析和科学计算中的常见任务,主要通过最小二乘法实现。该代码演示了二维空间中的直线拟合,输出斜率和截距。

深之JohnChen的专栏 1598

PATA1023题解

由于存在20位的数字,不能使用long long型,应使用字符串表示 // // main.cpp // PATA1023 // // Created by Phoenix on 2018/2/7. // Copyright © 2018年 Phoenix. All rights reserved. // #include #include #include int flag_a

Phoenix 317

STM32 CubeMX LwIP + freertOS 移植

生成代码,烧录即可ping通。这里要注意的是,要修改freertOS的任务栈大小,默认128,修改为1024,不修改就跑不起来。生产代码,下载进开发板。开发板网口与电脑网口通过网线直连,设置电脑本地网卡在同一网段。在以上无系统的cubeMX配置下继续添加freertOS。无系统LWIP协议栈设置,静态IP地址,关闭DHCP。先用裸机测试LAN8742A的网卡驱动。MCU型号:STM32F746NGH。下面进行freertOS系统移植。网卡型号:LAN8742A。系统时钟和时基定时器如下。

u011625775的博客 1375

7-49 Have Fun with Numbers(20 point(s))

Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number con...

学习为主,偶尔扯淡 792

飞傲Fiio+foobar2000 实现dsd解码+灯正常显示

飞傲Fiio+foobar2000 实现dsd解码+灯正常显示。安装后可将DSD格式的数据通过ASIO驱动传输至DAC。安装后可识别DAC的ASIO驱动。安装后可识别DSD文件。

yanlei7993的博客 2301

Palabos User Guide中文解读 | 第一章 | 介绍

译者的话:本人在学习palabos时,发现国内中文资料甚少,恰好网上可以直接搜到palabos user guide这种英文资料,加之时间充裕,便打算开始翻译,能不能完成全本翻译再说,而且文中我也会标记我不确定的地方,以传达意思为主,翻译不当的地方还请各位读者帮忙指正。 Palabos User Guide Release 1.0 r1 Copyright © 2019 University of...

Yulan Fang's notes. 6977

PAT A1023 Have Fun with Numbers (20point(s))

题目链接 #include<cstdio> #include<cstring> struct bign{//大整数结构体 int d[21],len; bign(){//结构函数初始化 memset(d,0,sizeof(d)); len=0; } }; bign change(char str[]){ //将...

皮皮瓜的博客 170

戴尔笔记本装Ubuntu 20.04,别急着分区!先搞定这个BIOS设置(Intel RST避坑指南)

本文详细介绍了在戴尔笔记本上安装Ubuntu 20.04时遇到的Intel RST技术兼容性问题及解决方案。通过安全切换至AHCI模式,避免安装过程中找不到硬盘的常见问题,并提供双系统分区策略和安装后的优化建议,确保Ubuntu与Windows 10双系统稳定运行。

weixin_31315567的博客 272

patA1023 have fun with numbers (20)

#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;cstring&gt;#include &lt;algorithm&gt;using namespace std;const int maxn=100001;int hashT[maxn]={0};int hashb[maxn]={0};struct bign{ int d[1...

QAQ的小耗子的博客 253

Ubuntu操作系统等保测评指南

Ubuntu操作系统等保测评指南

qq_40181198的博客 7029

【QNX+Android虚拟化方案】125 - 如何创建android-spare镜像

【QNX+Android虚拟化方案】125 - 如何创建android-spare镜像

|~~~热爱生活、努力学习的小伙汁~~~| 1092

pata1023

题目 pata1023 题目思路 常规题目,利用结构体存储大整数,然后遍历整数,在count数组中计数,乘以2后再次计数即可。 参考代码 #include<iostream> #include<cstring> using namespace std; typedef struct{ int a[100]; int len; }bgin; bool ispa(bgin...

zz73zz76的博客 245

KEPServerEX物联网网关(IoT Gateway)REST客户端代理(非原创)

(中文版)资料来源于【OPC-KEPServerEX学习KEPWare交流】905485143群的【455196383】【零下一度】 一。KEPServerEX物联网网关REST客户端代理演示 在KSE中,首先构建一个带有通道/设备/标签的模拟器系统。 例如,下面是三个随机项目。 直接到IoT网关插件,添加新代理。 从类型列表中选择REST Client。 终结点...

-雲飛兄-博客 5808

甲级pat-1023

#include&lt;iostream&gt; #include&lt;algorithm&gt; using namespace std; int main() { string s; cin&gt;&gt;s; int len=s.length(),arr_1[20],arr_2[20],arr_3[20],temp=0; for(int i=0;i&lt;...

LeetCode 305

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

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

PAT甲级1023 大整数加法

题目 题解 #include&amp;lt;iostream&amp;gt; #include&amp;lt;cstring&amp;gt; using namespace std; int book[10]; int main(){ char num[22]; scanf(&quot;%s&quot;,num); int flag=0; int len=strlen(num); for(int i=len-1;...

小夏要科学进步 731

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

PAT甲级1023

1023. Have Fun with Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Notice that the number 123456789 is

湛蓝的天空 888

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

PATA1134_hash(遇到开10000 * 10000数组的问题)

这个题如果开vis[10000][10000]第三、四测试点过不去。利用hash,开一个map<int, bool>。hash函数:a * 10000 + b。思考:不可能每个节点之间都有关系,所以再1000 * 1000以上数量的节点的图,要占用(10^8/ 2^20)~= 95.3MB内存,用邻接矩阵的话太大,太浪费了。 #include <bits/stdc++.h> using namespace std; unordered_map<int, vector&lt.

YYHCODE的博客 347

PATA1069_测试点安排!(难度:⭐️⭐️)

测试点找了半小时全给你找齐了,拿了留个评论????。 测试点: 测试点2:1000。每次运算都要补0因为1000 - 0001 = 0999,如果不补0就会出错(我就是卡在这)。 其他测试点:有可能是小于1000的数, 1。 测试点5:输入的就是6174。 #include <bits/stdc++.h> using namespace std; bool cmp (char a, char b) { return a > b; } int main() { int

YYHCODE的博客 336

PATA1108_测试点3巨坑(难度:⭐️⭐️⭐️)

测试点3应该是类似于大于1000然后还有个小数点的,例如:1001. 按照题目要求.42或者是42.都是合法的 我原来判断小数点都默认把带有小数点的树都在合法范围内,没有判断是不是在[-1000,1000]内 测试点三就一直过不去????; #include <bits/stdc++.h> using namespace std; bool judge (string s) { int cntClum = 0; for (int i = 0; i < s.size

YYHCODE的博客 284

PATA1060_测试点3_模拟(难度:⭐️⭐️⭐️)

这个题看似不难,但是细节处理还是有点烦的。 注意几个点: 1、首先判断小数点的位置,然后看去掉小数点后,字符串长度是否大于等于n。这里是要分别处理的,如果小于n的话要补0. 2、第一次交测试点3没过 想了一下测试用例:20.0340.03 自己的程序并没有考虑到数字是0.XXX的,所以在方法前面又加了判断是否是小于1的小数。最后就A了。 #include <bits/stdc++.h> using namespace std; int n; string tran(stri..

YYHCODE的博客 263

PATA1137_一道考基础的题

这道题考点应该是map<string, 结构体>,其他的都是基础。 si hse wu #include<bits/stdc++.h> using namespace std; struct stu { int Gp, Gm = -1, Gf = -1, G; string id; }; unordered_map<string, stu> mp; vector<stu> v; bool cmp (stu a, stu b) {

YYHCODE的博客 256

PATA1085_测试点4(难度:⭐️⭐️⭐️)

测试点4死活过不去,以后再想吧。。。 测试点三是长度为1. #include<bits/stdc++.h> using namespace std; vector<long long> v; int main() { int maxnum = 0, n; long long p, len = 0; scanf ("%ld %lld", &n, &p); vector<long long> v(n); for (

YYHCODE的博客 256

PATA1123_完全AVL树(模版题)

首先要知道完全二叉树,AVL树的定义。这个题看似复杂,但是分解为每一个小问题还是不难的。判断完全二叉树的方法就是,用after记录若某个节点的左子树为NULL时置为1,若还有节点push进来那就代表不是完全二叉树。 #include<bits/stdc++.h> using namespace std; struct node { int val; struct node *lc, *rc; }; node* leftRotate (node *tree) { nod

YYHCODE的博客 235

PATA1104_double导致的精度问题(难度:⭐️⭐️⭐️⭐️)

这个题目感觉出的不是很好,如果要考察double导致的精度问题。其实可以在题目末尾note,稍微提醒一下题目会在double精度问题上出考点,那就好了。考生应该是去解决问题,而不是猜问题。看了这位老哥写的非常好,https://blog.zhengrh.com/post/about-double/。其实学过计组的都知道,其实计算机用二进制是无法精确表达一些小数的,例如 0.3在二进制中只能近似表达,那么如果是用较大的数乘计算机中存储的0.3。就会出现误差,只能用string文本类型保存输入,并且自己写

YYHCODE的博客 233

PATA1135_红黑树(还是蒙的)

这个题直接没读懂,看了柳神的代码后自己照葫芦画瓢写了。还是有几个点没有搞懂。等二刷再来看看。 #include <bits/stdc++.h> using namespace std; struct tree { int v; tree *lc, *rc; }; vector<int> arr; tree *bulid (tree *root, int v) { if (root == NULL) { root = new tree();

YYHCODE的博客 231

PATA1025_STL(难度:⭐️⭐️)

没啥难度上代码。 #include <bits/stdc++.h> using namespace std; struct node { string id; int g, lct, lctRank; }; vector<node> ans; vector<vector<node>> v; bool cmp (node a, node b) { if (a.g != b.g) return a.g > b.g; ret

YYHCODE的博客 219
上一篇: PATA1024_大整数运算(难度:⭐️⭐️)
下一篇: PATA1022_STL(难度:⭐️⭐️)
YYHCODE
博客等级 码龄10年 0粉丝 132原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值