首页 > 无限长正整数排列字符串
头像 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])

等你来战

查看全部