[LeetCode]400. Nth Digit

petalinux i2c的配置 1.硬件平台配置 1.内核配置 cd petalinux-config -c kernel -> Device Drivers -> I2C support -> i2C Hardware Bus support -> Xilinx I2C Controller Pressing 启用CONFIG_I2C_XILINX=y 2.修改用户设备树 cd cd project-spec/meta-user/recipes-bsp/device-tree/files/ i2c2: 阅读详情

400. Nth Digit

题目描述

这里写图片描述

思路

计算出当前数字属于几位数digitCount,然后计算出目标数字在这个数中的具体位子digitIndex

代码

#include <iostream>

using namespace std;

class Solution {
public:
    int findNthDigit(int n) {
        long long base = 9;
        int digitCount = 1;
        while (n - base * digitCount > 0) {
            n -= base * digitCount;
            base *= 10;
            ++digitCount;
        }
        int numIndex = (n - 1) / digitCount;
        int digitIndex = digitCount - 1 - (n - 1) % digitCount;
        int num = base / 9 + numIndex;
        while (digitIndex--)
            num /= 10;
        return num % 10;
    }
};

int main() {
    int n;
    Solution s;
    while (cin >> n) {
        cout << s.findNthDigit(n) << endl;
    }
}
从C-EPS到DP-EPS:手把手图解不同EPS类型怎么选,对你的车操控感影响有多大? 方向盘转动时那股细腻的阻尼感,高速过弯时令人安心的沉稳,或是狭窄车位里一根手指就能拨动的轻盈——这些看似微妙的差异,其实都源自转向系统电机那几厘米的安装位置变化。当我们谈论驾驶乐趣时,发动机参数和悬架调校总是占据C位,但真正连接驾驶者与车辆的神经末梢,恰恰是那套默默工作的电动助力转向系统(EPS)。不同EPS类型带来的操控特性差异,可能比马力数字更能定义一辆车的性格。 阅读详情

相关推荐

Dify 部署与使用

本文介绍了Dify社区版的快速部署指南,涵盖系统架构、环境配置和初始化流程。Dify采用微服务架构,通过Docker Compose一键部署8个核心容器,包括前端、后端、数据库等组件。部署过程包括克隆代码、配置环境变量和启动服务,首次启动需3-10分钟下载镜像。文章详细讲解了.env文件的配置要点,包括服务地址、数据库连接和向量存储设置,并提供了生产环境安全加固建议。最后通过访问/install页面完成管理员账号初始化,即可开始使用Dify构建AI应用。

海兰 615

LeetCode刷题笔记--400. Nth Digit

400. Nth Digit 400. Nth Digit Easy 228705FavoriteShare Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range ...

vivian0239的博客 201

课程复习---分析空间数据的细胞空间关系(python版本的mistyR)

课程复习---分析空间数据的细胞空间关系(python版本的mistyR)

weixin_53637133的博客 1228

[Leetcode] 400. Nth Digit 解题报告

题目: Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a 32-bit signed integer (n 31). Example

魔豆(Magicbean)的博客 399

【机器学习—评估指标】混淆矩阵、准确率、精确率、召回率、F1分数、ROC曲线和AUC

机器学习评价指标是衡量模型性能的关键工具。本文介绍了常见指标及其计算方法:1.混淆矩阵展示分类预测结果分布,包含TP、TN、FP、FN四个基础指标;2.准确率反映整体预测正确率;3.精确率关注预测正例的准确性;4.召回率衡量正例检出能力;5.F1分数综合平衡精确率和召回率;6.ROC曲线通过TPR与FPR的权衡关系评估模型性能,AUC值量化区分能力。文章详细说明了各指标的定义、计算公式、适用场景及局限性,并通过Python代码示例演示了具体实现方法,特别对ROC曲线和AUC的计算原理进行了深入解析。

weixin_51375278的博客 6750

“傻瓜”学计量——双重差分DID3(多期双重差分原理+解决方案CSDID原理)

“傻瓜”学计量——双重差分DID3(多期双重差分原理+解决方案CSDID原理)

nnpersistent的博客 5070

【Leetcode】400. Nth Digit

题目链接:https://leetcode.com/contest/5/problems/nth-digit/题目: Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, … Note: n is positive and will fit within the range

业精于勤,荒于嬉 6502

CentOS7下用FreeRADIUS+AD实现802.1X认证完整指南(附华为交换机配置)

本文提供了在CentOS 7系统上部署FreeRADIUS并与Windows Active Directory集成,以实现企业级802.1X网络认证的完整实战指南。内容涵盖从架构原理、服务器配置(包括Kerberos、Samba Winbind集成)、FreeRADIUS核心设置与AD联动,到华为交换机的详细配置步骤。重点解决了生产环境中常见的高可用、动态VLAN下发及深度排错问题,为企业构建集中、安全的网络准入控制体系提供了经过验证的解决方案。

weixin_29273849的博客 416

Leetcode 400. Nth Digit (Easy) (cpp)

Leetcode 400. Nth Digit (Easy) (cpp)

还是需要多学习!闷声大发财,这是坠吼的! 745

安卓集成华为HMS Scankit实现自定义扫码功能

实现扫码功能 使用的是集成华为扫描的SDK,UI界面借鉴的是谷歌官方的Zxing项目中的自定义view,两者结合实现。 先上效果图: 先在项目根级别(build.gradle)当中配置HMS Core SDK的Maven仓地址。 // 配置HMS Core SDK的Maven仓地址。 maven {url 'https://developer.huawei.com/repo/'} // 配置HMS Core SDK的Maven仓地址。 maven {url 'https://developer.huaw

qq_47625961的博客 5521

Python高阶爬虫:逆向工程模拟Wind/同花顺等金融终端数据抓取

本文详细阐述了模拟金融数据终端进行数据抓取的全套技术方案。我们从法律合规性讲起,选择了Playwright作为核心自动化工具,通过两个实战案例(同花顺网页版和Wind桌面版)演示了从分析、模拟到数据解析的完整流程,并进一步介绍了构建健壮爬虫系统所需的高级技巧。我们的策略是:启动一个由Playwright控制的浏览器,模拟真人登录,然后监听所有网络请求,从中过滤出我们需要的那个数据API。if key in ['f43', 'f169', 'f170', 'f46', 'f60']: # 价格类字段。

2201_76125261的博客 551

Leetcode 400 Nth Digit

Leetcode 400 Nth Digitusing namespace std; class Solution { public: int findNthDigit(int n) { long numBit = 1;//long is necessary 1,2,3,4 bits of number long interval = 9;//1*9 2*90 3*900

自己的学习笔记 456

终于找到了!Ubuntu 虚拟机卡死的终极解决方案(如何解决VMware安装Ubuntu24.04桌面进不去、黑屏、虚拟机卡死、显示不全、屏幕闪烁等问题)

终于找到了!Ubuntu 虚拟机卡死的终极解决方案(如何解决VMware安装Ubuntu24.04桌面进不去、黑屏、虚拟机卡死、显示不全、屏幕闪烁等问题)

XiaoqiangClub的博客 1万+

[leetcode] 400. Nth Digit 解题报告

题目链接:https://leetcode.com/problems/nth-digit/ Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a

小榕流光的专栏 5564

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

[leetcode] 400. Nth Digit

Description Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, … Note: n is positive and will fit within the range of a 32-bit signed integer (n < 231). Example ...

Learning from the mistakes 360

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

C++版 - Leetcode 400. Nth Digit解题报告

leetcode 400. Nth Digit 在线提交网址: https://leetcode.com/problems/nth-digit/ Total Accepted: 4356 Total Submissions: 14245 Difficulty: Easy Find the nth digit of the infinite ...

weixin_33809981的博客 108

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

LeetCode 400. Nth Digit

原题网址:https://leetcode.com/problems/nth-digit/ Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a

James Pan 476

[一起来刷leetcode吧][29]--No.400 Nth digit

这篇文章是程序自动发表的,详情可以见这里 这是leetcode的第400题--Nth digit &emsp;&emsp;题目 Find the nth digit of the infinite integer se...

mbinary 219

leetcode【400】Nth Digit(python)

写在最前面: 为什么我觉得这道简单的题好难啊...感觉自己是个数学渣渣 纯原创,不会有人和我一样奇葩的思路的...   leetcode【400】Nth Digit   Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positiv...

ssjdoudou的博客 2万+

LeetCode-400. Nth Digit

问题:https://leetcode.com/problems/nth-digit/?tab=Description Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, **分析:**S1=1 S2=12 S3=123 S4=1234 … S9=123456789

Renzhouzhou的博客 606

【leetcode】400. Nth Digit(Python & C++)

400. Nth Digit题目链接400.1 题目描述:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …Note: n is positive and will fit within the range of a 32-bit signed integer (n < 2

I am what i am 1782

Leetcode 400. Nth Digit 第n个数字 解题报告

1 解题思想终于到了第400了 这道题是说从1开始的第n个数字是什么,注意是数字而不是数 如: 12是一个数,有两个数字1,2那么这题主要需要考虑第n个数是多少位的,然后是哪个数,数里面的哪个位置,而主要规律是: * 这里首先分析一下位数和规律 * 个位数:1-9,一共9个,共计9个数字 * 2位数:10-99,一共90个,共计180个数字 * 3位数:100-999,一共900个,共计

MebiuW的专栏 7028

Leetcode 400. Nth Digit

文章作者:Tyan 博客:noahsnail.com &nbsp;|&nbsp; CSDN &nbsp;|&nbsp; 简书 1. Description 2. Solution Version 1 class Solution { public: int findNthDigit(int n) { int digits = 1; ...

SnailTyan 423

LeetCode //C - 400. Nth Digit

【代码】LeetCode //C - 400. Nth Digit。

Made in Code 846

leetcode 400. Nth Digit

此题是求从1开始的正整数序列中的第n个数字 1,2,3,4,5,6,7,8,9,1 0,11,12… 第十一个数字是0 思路: 从1-9共有9个数字,基础数值为 0 ,每一位数字占有 1位 从10-99共有90个数字,基础数值为 9 ,每一位数字占有 2位 从100-999共有900各数字 99 ,每一位数字占有 3位 … 计算n处于哪一个区间,在根据基础数值加上剩余的数字位数即可得到最后一个数字...

Ben 181

LeetCode笔记:400. Nth Digit

找到序列中“名副其实”的第n个“数字”

Minecraft 1339
上一篇: [LeetCode]303. Range Sum Query - Immutable
下一篇: L0,L1,L2
charon____
博客等级 码龄11年 3粉丝 202原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值