首页 > 无限长正整数排列字符串
头像 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 展开全文
头像 深藏功与名的懒羊羊很贴心
发表于 2025-07-08 08:34:37
#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; string 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])
头像 ciallobite
发表于 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)
头像 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-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 = 展开全文
头像 unique琪殿
发表于 2025-08-29 11:03:28
n = int(input()) length = 1 # 当前数字的位数 count = 9 # 当前位数的数字的总个数(1位数有9个,2位数有90个,等等) start = 1 # 当前位数的起始数字(1位数从1开始,2位数从10开始,等等) while n > length * 展开全文
头像 缘珩369
发表于 2025-07-23 10:50:04
#include<bits/stdc++.h> #define int long long using namespace std; const int N = 1e5+10; const int M = 1e9+7; //下面这个函数为有效代码 void solve() { 展开全文