1023 Have Fun with Numbers (20分)(一个字水)

PAT 1023. Have Fun with Numbers (20) 【题目开始没理解好,后来折腾半天才搞懂】 1023. Have Fun with Numbers (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Notice that the number 123456789 is 阅读详情

1023 Have Fun with Numbers (20分)

分析

考察大整数的处理方法,对字符串进行乘二操作,并设置进位标记tag

代码

#include<iostream>
#include<string>
using namespace std;
int cnt[10];
string s;
int main() {
 cin >> s;
 bool tag = false;
 for (int i = s.size() - 1; i >= 0; --i) {
  ++cnt[s[i] - '0'];
  int d = 2 * (s[i] - '0') + tag;
  tag = false;
  if (d >= 10) {
   tag = true;
   d -= 10;
  }
  s[i] = d + '0';
  --cnt[d];
 }
 if (tag) {
  s.insert(s.begin(), '1');
  --cnt[1];
 }
 tag = true;
 for (int i = 0; i < 10; ++i)
  if (cnt[i] != 0)tag = false;
 printf("%s\n%s", tag ? "Yes" : "No", s.c_str());
 return 0;
}
PAT 1023 Have Fun with Numbers python解法 1023 Have Fun with Numbers (20 分) 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 happen... 阅读详情

相关推荐

PTA(Advanced Level) 1023:Have Fun with Numbers(C语言实现)

PTA(Advanced Level) 1023:Have Fun with Numbers(C语言实现) #include <stdio.h> #include <string.h> void Double(char s[]) { int i,c=0,k=strlen(s); for(i=k-1; i>=0; i--,k--) { s[k]=((s[i]...

LIve1AnD1LeARN的博客 360

1023. Have Fun with Numbers (20)-PAT甲级真题(大整数运算)

1023. Have Fun with Numbers (20) 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 happen

柳婼 の blog 2893

史上最全的Logisim运算器实验教程(基于华中科技大学计算机组成原理实验)

本博客是实现了Logisim的运算器设计,有具体的运算器设计的思路和运算器设计的电路,适合一步一步的按照思路做。

qq_62325622的博客 4万+

1023 Have Fun with Numbers (20分)

题目 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 ...

小白的博客 232

缺陷检测:使用PatchCore训练自己的数据集

必须包含有训练图片(无缺陷图片)、测试图片(缺陷图片)和ground_truth,并且ground_truth必须与对应图片的名称相同。同上一篇结果一样,我的输出为原始图片大小,但是不知道是不是因为图片不是正方形的,导致训练结果不好。编写一个脚本,重新规划数据集的路径规则,但是我稍微写复杂了一点,使用了类来操作。第二种(复杂):编写一个自己的Dataset,参考。第一种(简单):将数据集路径规则改成项目中。返回的必须是一个字典类型,可以阅读。本人此次使用的是第一种方法。运行时,参数部分直接输入。

xiaoxTai的博客 6483

Zabbix 7.0 从入门到精通部署手册

zabbix 入门到精通

weixin_43806846的博客 1032

PAT甲级 1023 Have Fun with Numbers

PAT甲级 1023 Have Fun with Numbers 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...

旺崽的博客 2922

别再被无限debugger卡住了!Chrome DevTools实战绕过技巧(含Hook与文件替换)

本文详细介绍了如何通过Chrome DevTools绕过无限debugger封锁的实战技巧,包括Hook技术与文件替换方法。针对常见的定时器轰炸、循环陷阱和动态注入等反调试手段,提供了高效的解决方案,帮助开发者快速突破调试障碍,提升爬虫和逆向工程效率。

weixin_30326515的博客 243

1023 Have Fun with Numbers (20)(20 分)

1 题目 2 解题思路 3 AC代码 1 题目 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 ha...

大山喵写博客的地方 701

ABtest描述统计功效

我们在面试数据分析时,常常会问到如何确定样本量的问题,会有一个指标:统计功效(power),或者是1-β 统计功效会影响实验的可信度,甚至会影响实验所需的样本量,要了解统计功效,首先要理解两类统计错误 假如我们做了一个AB实验,且两组用户的数据均值为μ1和μ2,我们会有两个初始假设: H0:两个实验组的数据没有差别(μ1=μ2),这个假设也叫“零假设”,也叫原假设 H1:两个实验组之间的数据存在差别(μ1≠μ2),这个假设也叫“非零假设”,也叫备择假设 定义两类错误: 实验本身没有效应,但我们觉

qq_38134556的博客 903

大模型LLM部署方式

建议根据实际需求选择方案,企业级服务优先考虑vLLM或TGI,个人用户可尝试Ollama或Hugging Face本地加载。若需完整代码示例,可参考网页2的VLLM实战或网页5的TGI部署案例。:高并发、低延迟的API服务,需分布式推理支持。:快速创建可分享的Web应用。:个人开发、快速原型验证。

u010249118的博客 516

[PAT-Advanced] A1023 Have Fun with Numbers (20)

文章目录A1023 Have Fun with Numbers (20point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis Author: CHEN, Yue Organization: 浙江大学 Time Limit: 400 ms Memory Limit: 64 MB...

Duke 286

SPSS线性混合模型实战:手把手复现一篇老年认知研究的统计结果(含代码)

本文详细介绍了如何使用SPSS线性混合效应模型复现老年认知研究的统计结果,涵盖数据准备、模型构建、结果解读及可视化全流程。特别针对重复测量数据分析,提供了SPSS菜单操作与语法编写的实用技巧,帮助研究者高效处理复杂数据并验证模型假设。

weixin_42562079的博客 518

1023. Have Fun with Numbers (20)

题目链接:http://www.patest.cn/contests/pat-a-practise/1023 题目: 1023. Have Fun with Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard

Apie_CZX的专栏 4073

【雷达】一维和二维自适应波束形成(DBF))DBF附matlab代码

1 简介 数字波束形成技术是天线波束形成原理与数字信号处理技术相结合的产物,其广泛应用于阵列信号处理领域.由于电磁工作环境的恶化和大量射频干扰的存在,在极低的信干噪比(SINR)条件下进行目标检测和信息提取十分困难.对于阵列系统,往往采用自适应数字波束形成(ADBF)技术,来抑制强干扰和方向性干扰对有用信号的影响.介绍了数字波束形成器的基本原理及其DSP的实现结构.​ 2 完整代码 clc;clear all;close all;%%%%%%%%%%%%%%%%%一维DBF%%%%%%%%%%%%%

qq_59747472的博客 7269

计算机控制技术及应用

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

PAT (Advanced Level) 1023 Have Fun with Numbers (20 分) 【Python/C++】【大数乘法】

PAT (Advanced Level) 1023 Have Fun with Numbers (20 分) 按位做大数乘法即可 Python: import sys from math import * str_in = input() length = len(str_in) b = [int(n) for n in str_in.split()] n = b[0] a = [0]*100 ...

Irish_Moonshine的博客 323

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

PAT甲级 1023 Have Fun with Numbers (20分)

1023 Have Fun with Numbers (20分) 题目链接:PAT A 1023 题目大意:给出一个不超过20位的整数n,要求将这个数乘以2,然后于原始数作比较看看是否有新增的数字,有则输出Yes,没有则输出No。还要输出乘以2后的数。 思路分析:由于最大的数可能有20位,所以不能定义一般的整型变量int,long long int也不能解决问题,所以涉及到大整数运算的知识点。...

weixin_43684054的博客 339

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

1023 Have Fun with Numbers

1023Have Fun with Numbers(20point(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, whic...

coderwait 234

PAT 甲级 1023 Have Fun with Numbers

1023 Have Fun with Numbers (20 分) 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 consisting exactly the nu

qq_42323299的博客 272

PAT 1023. Have Fun with Numbers (20)

http://pat.zju.edu.cn/contests/pat-a-practise/1023

Steve Sun的专栏 3158

1023 Have Fun with Numbers (20 分)

1023Have Fun with Numbers(20分) 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 happe...

Super_gxw的博客 303

1023 Have Fun with Numbers (20 分)

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 ...

SourDumplings的博客 203

[PAT A1023]Have Fun with Numbers

[PAT A1023]Have Fun with Numbers 题目描述 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 ...

欢迎来到我的编程小屋 947
上一篇: 1024 Palindromic Number (25分)(一个字短!)
下一篇: 1021 Deepest Root (25分)(一个字短!)
大了七八个
博客等级 码龄8年 2粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值