1010 Radix (25分)(一个字短!)

SCU【C】程序设计基础期末安全项目lab2-Deadbeef-writeup(附题目&源码) 项目名称(本质:栈溢出攻击)【源码在文首】和lab1一样,此题又是美国卡耐基梅隆大学的平时作业哈哈哈! 项目要求是把栈溢出,强行更改函数返回值,输出0xdeadbeef。 阅读详情

1010 Radix (25分)

分析

二分法搜索目标进制,不失一般性,假设tag=1,初始的左边界设为b各位中最小数字加一,右边界设为a

代码

#include<iostream>
#include<string>
using namespace std;
long long int getnum(string s, int d) {
 long long int a = 0, z = 1;
 for (int i = s.size() - 1; i >= 0; --i, z *= d) {
  int aa = (s[i] <= '9' && s[i] >= '0') ? (s[i] - '0') : (s[i] - 'a' + 10);
  a += aa * z;
  if (a < 0 || z < 0)return -1;
 }
 return a;
}
int get_lower_bound(string s) {
 int m = 0;
 for (int i = 0; i < s.size(); ++i) {
  int d = (s[i] <= '9' && s[i] >= '0') ? (s[i] - '0') : (s[i] - 'a' + 10);
  m = (m < d) ? d : m;
 }
 return m + 1;
}
int main() {
 string sa, sb;
 int tag, d;
 cin >> sa >> sb >> tag >> d;
 if (tag == 2)swap(sa, sb);
 long long int a = getnum(sa, d), b;
 long long lower_bound = get_lower_bound(sb), upper_bound = a, mid;
 while (upper_bound >= lower_bound) {
  mid = (lower_bound + upper_bound) / 2;
  b = getnum(sb, mid);
  if (b >= a || b < 0)upper_bound = mid - 1;
  else lower_bound = mid + 1;
 }
 b = getnum(sb, lower_bound);
 if (b != a)printf("Impossible\n");
 else printf("%lld\n", lower_bound);
 return 0;
}
统信UOS安装CH384串口卡驱动 本文讲解如何在统信UOS系统下安装CH384 PCIE多串口驱动安装过程,CPU为飞腾D2000。其他Linux内核系统安装亦可参照类似方法。 阅读详情

相关推荐

调试GMS应用,报错“此设备未获得play保护机制认证”问题解决

不少同学在调试GMS相关应用时,需登录Google账号,有时会弹出如下通知。Google登录界面也会出现如下提示这个报错的原因是设备未通过Google认证,google服务器未配置荣耀设备的型号白名单导致国内网页有一些指导方法在鸿蒙\荣耀的设备上消除这个提示,但本质的问题没有解决,无法登录Google账号。

胡同老道的博客 2万+

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

海绵的博客 213

基于ESP32-P4的低成本旋转式激光雷达系统设计

激光雷达(LiDAR)作为机器人环境感知的核心传感器,其本质是融合光学测距、机电控制与实时数据处理的嵌入式系统。理解时间飞行(ToF)原理与机械旋转耦合机制,是实现高精度点云采集的基础;而系统级误差源——如计时抖动、电机惯性、信号串扰和温漂——直接决定实际建图鲁棒性。在资源受限场景下,选用RISC-V双核MCU(如ESP32-P4)可兼顾实时控制与网络服务能力,通过硬件时间戳捕获、S型加减速轨迹规划、旋转变压器供电及双Bank OTA等工程手段,有效平衡分辨率、帧率与稳定性。本文围绕360°旋转式激光雷达的

weixin_36231030的博客 434

1010 Radix

写了一天的题,心态爆炸 import java.io.BufferedInputStream; import java.math.BigInteger; import java.util.Scanner; /** * Main */ public class Main { static char[] n1; static char[] n2; static int t...

bZone 246

UE5Could not be compiled. Try rebuilding from source manually.

UE5Could not be compiled. Try rebuilding from source manually.

weixin_45417260的博客 2771

DRV8311HRRWR直流无刷(BLDC)电机驱动原理图设计

DRV8311HRRWR集成三个MOSFET 半H桥,用于驱动三相无刷直流电机(BLDC),适用于5V、9V、12V或18V直流电源轨或1S至4S电池供电应用。内部集成三个具有集成电流感测功能的电流感测放大器(CSA),可感测BLDC电机的三相电流,从而实现FOC和电流控制系统设计方案。集成保护特性:VM 欠压锁定 (UVLO)、 电荷泵欠压 (CPUV)、过流保护 (OCP)、热警告和热关断 (OTW/OTSD)、故障条件指示引脚 (nFAULT)支持 1.8V、3.3V 和 5V 逻辑输入。

zhusl6688的博客 1228

1010 Radix (25分)

设给出数字十进制值为n1,待求数字十进制值为n2。 虽然给出的单个字符在范围0-10或a-z内,但是待求基数不一定最高为36,待求基数可能远大于36。 待求基数的最大值为n1,因为: 如果n2只有一位,那么基数大小不影响n2的值,n2的基数只需要大于n2中权数最高的位。 如果n2位数大于一位,那么给出的数字至少为10,它的次低位权值为n1^1,这时n2 == n1。如果基数大于n1,n2必然大...

void 236

英伟达(NVIDIA) 显卡型号、计算能力(CC)、CUDA版本、PyTorch版本 对照表

本文全面梳理NVIDIA显卡型号与其计算能力(CC)的对应关系,并详解各代CUDA版本对不同架构的支持与弃用情况,帮助用户判断硬件兼容性。同时,结合PyTorch官方发布版本,整理其支持的CUDA版本清单,指导开发者合理选择深度学习环境配置。涵盖从Jetson嵌入式设备到H100、Blackwell等最新旗舰显卡,是一份实用的AI开发环境搭建参考指南。

寒水馨 · 轻量级技术文档 · hanshuixin.org 4898

1010 Radix:猥琐的测试数据

谨以此题纪念边界测试数据浪费了我多少时间:https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include ...

weixin_30745553的博客 592

深入解析雪球网股票行情数据爬取:基于WebSocket与API的实时数据获取技术实践

本文详细介绍了如何使用Python爬虫技术获取雪球网的股票行情数据,涵盖了WebSocket实时数据连接和RESTful API接口调用两种主要技术方案。完整的WebSocket客户端,支持实时行情订阅和数据处理功能丰富的API客户端,支持多种数据类型的获取数据存储和管理系统,使用SQLite进行数据持久化实时监控和预警系统,支持自定义预警规则技术指标计算,提供基本的数据分析功能。

2201_76125261的博客 1256

YOLOv11改进策略【模型轻量化】| 替换骨干网络为 2024轻量化网络MoblieNetV4:移动生态系统的通用模型

一、本文介绍 本文记录的是基于MobileNet V4的YOLOv11目标检测轻量化改进方法研究。MobileNet V4通过整合UIB、Mobile MQA以及优化的NAS策略,能够在在不降低性能指标的前提下,降低计算成本。本文配置了原论文中MNv4-Conv-S、MNv4-Conv-M、MNv4-Conv-L、MNv4-Hybrid-M和MNv4-Hybrid-L五种模型,以满足不同的需求。 模型 参数量 计算量 推理速度 YOLOv11m 20.0M 67.6GFLOPs 3.5ms

Limiiiing的博客 4462

*甲级PAT 1010 Radix(二分搜索+坑)

1010 Radix (25)(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 ...

Joyceyang_999的博客 1637

【VS Code插件开发】通用功能(二)

本篇主要从command(命令)、menus(菜单)、快捷键三个方面讲解,都归于通用功能。

编码世界 1万+

1010 Radix (25)(25 分)

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

大山喵写博客的地方 4747

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

PAT练习题(甲级) 1010 Radix (25分)(Java实现)

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 integer

CoderHqf的博客 1万+

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

1010 Radix (25 分)

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

qq_42711300的博客 537

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

1010 Radix (25 分)

1010Radix(25分) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number. Now for any pa...

树叶子的博客 413

【PAT甲级】1010 Radix (25 分)

1010 Radix 题目描述 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 o...

初见还是重逢的博客 1137

PAT-A-1010 Radix (25 分) 二分求解

1010 Radix (25 分) 一、题目大意 给出两个数n1,n2,还给出tag和radix,如果tag为1,则radix为n1的进制,如果tag=2,则radix为n2的进制,求另一个数在什么进制下与这个数相等。 二、解题思路 首先:当tag=2时,swap(n1,n2) 此题有坑。我刚开始以为所求进制只是从2到36,因为输入的两个数中只有0-z,分别代表基数0-35,然鹅,提交了好多次...

爱玲姐姐的博客 945

PAT甲级 1010 Radix (25分)

1010 Radix (25分) 题目链接: PAT A 1010 这道题难度比较大,而且测试点还非常多,我debug就花了一天时间,尽量为大家讲解的清楚一些吧。 思路分析:这题给两个数和其中一个数的进制,要找出另外一个数是什么进制的时候使得这两个数相等。注意题目里数位的范围是0-35,但是这个进制不一定小于36,而是从2到int最大值甚至是long long最大值的任意一个数,比如1可以是二进...

weixin_43684054的博客 364

1010 Radix (25 分) 超级坑恶魔坑

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

ZXX_1999的博客 374

PAT 甲级 1010 Radix (25分)

题目 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 integers N1 and N2, your task is to find

qq_41001689的博客 184

PAT 甲级 1010 Radix (25 分)(Java)

文章目录PAT 甲级 1010 Radix (25 分)(Java)题目题意解读解题思路解法解法一 PAT 甲级 1010 Radix (25 分)(Java) 题目 题目链接 题意解读 这题的大体意思就是给两个数N1和N2,数位长度不超过10,并指出其中一个数是几进制数,然后问将另一个数转换为多少进制,可以使得N1==N2; 解题思路 首先要明确的一个点是: 虽然题目表明了其中给出进制的数一定会是35进制以内的数,假设为N1,因为使用0-9,a-z只能表示到最高35进制,但这并不意味着另一个数也是如此,另

盼你到天明的博客 334

PAT 甲级1010 Radix (25 分)

1010Radix(25分) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number. Now for any pa...

Dexter 279

1010 Radix (25 分)

1010 Radix (25 分) 题目大意: 样例中给出了4个数据 分别是 数字n1 n2 一个标记 数字dec 某个数的进制 题目要求 如果标记是1 那么dec就是数字n1的进制 如果标记是2 那么dec就是数字n2的进制 我们要做的是算出另一个数字在多少进制的情况下会和原本数字相等 分析: 这道题需要把先知道的那个数字转化为十进制,再把后来的那个dec进制的数字也转化为十进制,如果相等则输...

Fighting_Eagle的博客 271

1010 Radix (25分) PAT甲级 Java 实现

1010 Radix (25分) PAT甲级 Java 实现 文章目录1010 Radix (25分) PAT甲级 Java 实现1 题目2 解题思路2.1 题目大意2.2 题目细节2.3 解题思路3 代码 1 题目 题目链接 https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 Given a pair of positive integers, for example, 6 and 110, can

qq_38650754的博客 278
上一篇: 1018 Public Bike Management (30分)(不长,不水)
下一篇: 1020 Tree Traversals (25分)(一个字短!)
大了七八个
博客等级 码龄8年 2粉丝 30原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值