首页
比赛
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
无限长正整数排列字符串
9条解析
开通博客写题解
ciallobit
发表于 2025-05-31 11:28:17
n = int(input()) s = "" for i in range(1, n + 1): s += str(i) print(s[n - 1]) 不用枚举,时间复杂度O(n)
Hanson_Zhong
发表于 2022-05-13 16:35:16
链接:https://ac.nowcoder.com/acm/contest/19306/1035 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 珂朵莉想求12345678910
展开全文
GB279824
发表于 2025-06-08 14:18:08
s = int(input().strip()) def find_pos(s): if s <= 9: return str(s) elif s <= 189: s -= 9 index = (s-1) // 2
展开全文
Silencer76
发表于 2025-06-10 13:55:30
题目链接 无限长正整数排列字符串 题目描述 定义一个无限长的字符串 S,它是通过按顺序拼接所有正整数 1, 2, 3, 4, ... 得到的。 S = "123456789101112131415161718192021..." 给定一个整数 n,任务是找出并输出字符串 S 的第
展开全文
鹿沉
发表于 2025-06-20 00:01:13
n = int(input()) res = '' for i in range(1, n + 1): res += str(i) print(res[n-1])
冷意
发表于 2025-06-03 23:43:25
#include <iostream> #include <string> using namespace std; int findNthDigit(int n) { int digits = 1; // 当前数字位数 long long count =
展开全文
阿祖拉
发表于 2025-06-11 13:42:18
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in =
展开全文
牛客771747820号
发表于 2025-06-14 14:41:00
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in =
展开全文
爱读书的菠萝蜜很想去杭州
发表于 2025-06-09 18:32:27
n = int(input()) s = '' for i in range(1,n+1): if len(s)>=n: break else: s += str(i) print(s[n-1])
查看本题
查看本题讨论
相关比赛
40-牛客练习赛9
进入比赛
8222-上海理工大学(10.16)
进入比赛
19306-牛客竞赛语法入门班数组字符串习题
进入比赛
19973-cslg_新生刷题训练4(数组字符串)
进入比赛
21042-南宁师范大学2021年3i国庆练习题
进入比赛
等你来战
查看全部
牛客周赛 Round 98
报名截止时间:2025-06-29 21:00
金山杯2025年武汉理工大学程序设计竞赛
报名截止时间:2025-06-30 15:00
牛客小白月赛119
报名截止时间:2025-07-04 21:00
牛客周赛 Round 99
报名截止时间:2025-07-06 21:00
牛客练习赛142
报名截止时间:2025-07-11 21:30
牛客周赛 Round 100
报名截止时间:2025-07-13 21:00
2025牛客暑期多校训练营1
报名截止时间:2025-07-15 17:00
2025牛客暑期多校训练营2
报名截止时间:2025-07-17 17:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题