【hdoj1002】 A + B Problem II(模拟加法)

全志T133-s3(Tina Linux)下RTL8723DS WiFi驱动移植与调试实战 本文详细介绍了在全志T133-s3平台(Tina Linux)上移植RTL8723DS WiFi驱动的完整流程,包括硬件连接、驱动源码获取、内核配置、系统适配、设备树配置以及常见问题排查。通过实战案例,帮助开发者快速解决SDIO接口通信、固件加载、电源管理等关键问题,实现稳定的WiFi功能。 阅读详情



思路:

        普通的加法模拟,

        注意直接输入的数和所要运算的数刚好顺序颠倒

        本题最大难点:格式!!!!我PE了不下3次。。。最关键的是最后三行的回车

       <记住,oj中每行最后不能多空格,运行结果最后只能一个回车。具体情况看题目要求。。。>


#include<stdio.h>
#include<string.h>
void main()
{
   int T,x;
   scanf("%d",&T);
   getchar();
   for(x=0;x<T;x++)
   {
          char a1[1001]={'0'};
	  char b1[1001]={'0'};
	  char a[1001]={'0'};
	  char b[1001]={'0'};
	  char ans[1001]={'0'};
	  int t=0,i,j,k=0;
	  scanf("%s %s",a1,b1);
	  printf("Case %d:\n",x+1);
	  int len1=strlen(a1);
	  int len2=strlen(b1);
	  int len=(len1<len2)?len2:len1;
	  for(i=0;i<len1;i++)
		  a[i]=a1[len1-1-i];
	  for(i=0;i<len2;i++)
		  b[i]=b1[len2-1-i];
	  i=0,j=0;
	  while(k<len)
	  {
		  if(a[i]&&b[j])
		  {
			  ans[k++]=(a[i]+b[j]+t-'0'-'0')%10+'0';
		      t=(a[i++]+b[j++]+t-'0'-'0')/10;
		  }
		  else if(a[i]||b[j])
		  {
		      ans[k++]=(a[i]+b[j]+t-'0')%10+'0';
		      t=(a[i++]+b[j++]+t-'0')/10;
		      //printf("%c %d\n",ans[k-1],t);
		  }
	     else 
		 {
		      ans[k++]=t+'0';
			  t=0;
		 }
	  }
	  if(t==1)
	  {
	      ans[k++]=t+'0';
	  }
	  printf("%s + %s = ",a1,b1);
	  for(i=k-1;i>=0;i--)
		  printf("%c",ans[i]);
	  printf("\n");
	  if(x!=T-1)
		  printf("\n");
   }
}


强化学习算法案例——一个经典的走迷宫任务。 作者:禅与计算机程序设计艺术 1.简介 在强化学习(Reinforcement Learning, RL)中,有一个经典的任务——走迷宫,其原理简单易懂,但它的实际意义却深远,它让计算机学习如何通过策略网络(policy network),以最佳的方式解决复杂的任务。本文将介绍如何用强化学习解决这个经典 阅读详情

相关推荐

如何在Tagetik系统中抽取处理SAP系统财务数据

如何在Tagetik系统中抽取处理不同核算系统财务数据:以SAP为例,简单讲一下Tagetik对接SAP数据的基本情况

2201_75401663的博客 585

HDOJ-1002-A + B Problem II

HDOJ-1002 A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 506682 Accepted Submission(s): 97265 Problem Description I ha...

HDUCheater的博客 650

手把手教你用Simulink搭建交流异步电机矢量控制模型(附完整仿真文件)

本文提供了一份详细的Simulink仿真指南,手把手教你从零开始搭建交流异步电机矢量控制模型。内容涵盖主电路搭建、坐标变换实现、双闭环PI调节器设计、转子磁链观测器调试等核心步骤,并附有完整的仿真文件,帮助读者跨越理论到实践的鸿沟,掌握高性能电机控制系统的建模与仿真技能。

pz890123的博客 682

ACM--大数相加--HDOJ 1002--A + B Problem II

HDOJ题目地址:传送门 A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 315080    Accepted Submission(s): 61120 P

戎码人生 2667

Oracle Scheduler任务故障诊断 实战指南

当基础环境无异常时,需聚焦任务本身的配置与状态。定义(JOB)→ 调度(SCHEDULE)→ 执行(SLAVE进程)→ 日志(LOG),每个环节都可能存在卡点。Oracle Scheduler任务的“隐性故障”看似棘手,实则是环境配置、资源竞争、时间逻辑等问题的集中体现。通过本文的诊断工具和排查思路,你可以构建从“基础环境→任务配置→执行链路→日志追踪”的全维度分析体系,让每一个“消失”的任务都无所遁形。

Nuzbb的博客 1082

HFSS仿真平行线定向耦合器学习笔记

材料:FR4(玻璃纤维环氧树脂),介电常数:4.4,损耗角正切:0.02,厚度0.8mm。扫频方式:快速扫频,扫频范围:1.0GHz~3.0GHz,步进:0.01GHz。端口2是端口1关于Y轴对称,端口3,端口4是端口1和端口2关于X轴对称得到。求解中心频率:2.0GHz,迭代次数:20,收敛误差为0.02。右键设置边界条件----辐射边界。激励方式:集总端口激励。

qq_36521926的博客 4510

HDOJ 1002 A + B Problem II

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 题目大意:先输入一个n,表示有n组数据,每组数据有两个1000位以内的整数a和b,输出a+b。 题目思路:1000位已经超过了现有数据类型能表示的范围,所以使用模拟运算的方法,一位一位计算。 AC代码: // HDOJ // 1002.cpp /* ID: Firwale

Step by step, be the best. 789

一文读懂Cache一致性原理

本文介绍了为什么需要维护cache一致性、一致性协议的本质和类别,以及如何设计一致性协议。

W1Z1Q的专栏 6890

杭电OJ 1002 题目解答

HDOJ 1002 A+B Problem Ⅱ AC 代码: #include <iostream> #include <string> #include <algorithm> using namespace std; int x[1001],y[1001],res[1001]; int main() { int n; cin>>n; for(int k=1;k<=n;k++) { //重点

weixin_44802633的博客 2614

最新Python爬虫实战(入门爬虫篇)——案例13:某乎热榜数据采集(详细爬虫思路截图+抓包动图演示+完整爬虫代码+详细注释)

本次案例通过Python爬虫技术,成功实现了基于Cookies认证的某乎热榜数据爬取与Excel保存。代码采用模块化设计,包含Cookies解析、HTML请求、结构化解析、Excel持久化等完整流程;通过配置浏览器请求头+Cookies认证,有效突破某乎基础反爬策略,保证请求稳定性。整个爬虫逻辑遵循“Cookies认证 → 页面请求 → HTML解析 → 数据清洗 → 保存到Excel”的标准流程,与需要会话验证的网站爬取范式高度一致。Cookies解析与认证。

努力让自己发光,对的人才能迎着光而来 33万+

课设:FPGA音频均衡器 verilog设计及仿真 加报告

未来,随着FPGA技术的进一步发展和应用场景的扩大,FPGA音频均衡器将发挥出更大的作用,并为音频领域带来更多创新和突破。(a)音乐制作:均衡器可以调整音频信号中不同频段的能量分布,使得乐器声音更加明亮、动感,从而提升音乐制作的质量和创作的灵活性。以上步骤提供了设计一个音频均衡器的大致过程,但值得注意的是,具体实现的细节和复杂度可能因设计要求和所使用的平台而有所不同。确保设计满足预期的性能和要求。确定均衡器的功能和要求:定义你的音频均衡器需要实现的功能,包括频率范围、增益范围以及可调参数数量等。

QQ_778132974的博客 1593

HDOJ 1002 A + B Problem II 超详细

HDOJ 1002 A + B Problem II Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T<=20) which means the number of

qascetic的博客 242

V4L2教程(1):Ubuntu V4L2开发环境搭建与设备探索

欢迎来到V4L2学习指南的第一篇!本文将带你从零开始,在Ubuntu系统上搭建完整的V4L2视频采集开发环境。无论你是想开发视频监控、视频会议还是机器视觉应用,掌握V4L2都是Linux视频开发的必经之路。 **本节学习目标**: - 理解V4L2的基本概念和架构 - 搭建Ubuntu下的V4L2开发环境 - 掌握v4l2-ctl等调试工具的使用 - 学会检测和配置USB摄像头设备

琅嬛福地 427

HDOJ 1002 A + B Problem II(A+B 大数版)

url:http://acm.hdu.edu.cn/showproblem.php?pid=1002 这道题比较复杂一点,不能直接使用加法(当然可以用 java的 大数) 直接上代码: 第一次没有ac(Runtime Error (ACCESS_VIOLATION)) #include<stdio.h> #include #include using namespace std; in...

qq_27607655的博客 242

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

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

hdoj 1002 A + B Problem II

题目描述:   A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 260678    Accepted Submission(s): 50403 Problem Description

longge33445的博客 439

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

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

hdoj1002(大数加法)

A + B Problem II<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 60420    Accepted Submission(s): 11074<br /><br />Problem DescriptionI have a very simple problem for you. Given two integer

独行闹市无人问,青灯剑影响素琴 870

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

HDOJ 1002 A + B Problem II(java)

HDOJ 1002 A + B Problem II(java)第一个hdoj的题目,先拿来试试格式! 貌似提交了好几次才AC 代码: import java.math.BigInteger; import java.util.Scanner;public class HDOJ_1002 { public static void main(String[] args) {

a568283992的博客 447

杭电OJ 1002 A + B Problem II C语言

用两个字符串保存数据。先对齐, 比如1 111 -> 001 111。然后从串尾字符开始,转成int做加法, 同时加上上一位的进位,最后按格式输出。

Thurs的博客 727

hdoj 1002 A + B Problem II 【大数加法模板】

A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 265911    Accepted Submission(s): 51497 Problem Description I have a

dxx_111的博客 635

HDOJ1002 A + B Problem II(大数)

题目链接: 简单的A + B,但是题目中给的数据不超过1000位,爆long long。 java大数写法: import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { public static void main(String[] args) { Sc

GKHack's Blog 1125

HDOJ 1002 A + B Problem II ( 大数相加)

A + B Problem II(点击进入题目) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 314071    Accepted Submission(s): 60860 Problem Description

Shyazhut 388

HDOJ1002 A + B Problem II(大数加法)

HDOJ 1002 解题方法: 先将字符串反转存入整形数组,整形数组按位相加,若相加后大于十则前一位加一。相加结束后,倒叙逐个输出整形数组的每一位数。 #include<stdio.h> #include<stdlib.h> #include<string.h>int max(int x,int y) { int z; z=x>y?x:y;//比较两个值大小

xx_ii 487

hdoj1002A + B Problem II(大数加法)~

Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.   Input The first line of the input contains an integer T(1<=T<

qingkong5886的博客 488

[HDOJ1002] A + B Problem II 高数度加法运算

A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calcula

AJIOY的专栏 1230

HDOJ1002 A+B Problem II

HDOJ1002 A+B Problem IIWrong Answer.代码如下: 1 #include<iostream> 2 3 using namespace std; 4 5 6 int main() 7 { 8 int n; 9 while(cin>>n &&n) 10 ...

weixin_30732825的博客 96

hdoj1002--A + B Problem II

Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T<=

Code for ACM 560
上一篇: 【ACM暑假培训】3、模拟算法(99乘法表+方块转换+循环数)
下一篇: 【hdoj1052】Tian Ji -- The Horse Racing(贪心)
PrincessLin
博客等级 码龄14年 26粉丝 61原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址