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
题解:暴力....
代码:
#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;
}