Problem 40 Champernowne's constant (暴力vector)

本文探讨了查姆珀诺恩常数问题,该常数通过连接正整数形成一个无限的不可约小数分数。文章分享了一种通过编程手段找到特定位置上的数字并计算这些数字乘积的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Champernowne's constant

Problem 40

An irrational decimal fraction is created by concatenating the positive integers:

0.123456789101112131415161718192021...

It can be seen that the 12th digit of the fractional part is 1.

If dn represents the nth digit of the fractional part, find the value of the following expression.

d1 × d10 × d100 × d1000 × d10000 × d100000 × d1000000


Answer:
210
Completed on Sun, 30 Oct 2016, 06:19
题解:暴力....

代码:

#include<bits/stdc++.h>
using namespace std;
vector<int> s;
void gao(int n)
{
	int k=n;
	while(k!=0)
	{
		s.push_back(k%10);
		k/=10;
	}
}
int main()
{
	
	for(int n=200000;n>=1;--n)
	{
		 gao(n);
	}
	cout<<s.size()<<endl; //1088895
	
	cout<<s[1088894]<<endl;//1
	cout<<s[1088885]<<endl; //10
	cout<<s[1088795]<<endl;//100
	cout<<s[1088894]*s[1088885]*s[1088795]*s[1087895]*s[1078895]*s[988895]*s[88895]<<endl; //ans
	return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值