-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem40.cpp
More file actions
28 lines (25 loc) · 776 Bytes
/
Problem40.cpp
File metadata and controls
28 lines (25 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Krishna Mohan
Project Euler - Problem 40
Date: 3/24/2015
*/
#include <bits/stdc++.h>
using namespace std;
#define fo(i, n) for(int (i)=0;(i)<(n); (i)++)
#define MAX 1000001
int main()
{
ios_base::sync_with_stdio(0);
string str="0";
for(int i=1;i<MAX;i++)
{
ostringstream ss;
ss<<i;
str+=ss.str();
}
/*cout<<str[12]<<" : "<<((str[10]-'0')*1)<<" : "<<((str[12]-'0')*1)<<endl;
cout<<(str[1]-'0')<<" : "<<(str[10]-'0')<<" : "<<(str[100]-'0')<<" : ";
cout<<(str[1000]-'0')<<" : "<<(str[10000]-'0')<<" : "<<(str[100000]-'0')<<" : "<<(str[1000000]-'0')<<endl;*/
cout<<((str[1]-'0')*(str[10]-'0')*(str[100]-'0')*(str[1000]-'0')*(str[10000]-'0')*(str[100000]-'0')*(str[1000000]-'0'))<<endl;
return 0;
}