We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #40: Champernowne's constant

Project Euler #40: Champernowne's constant

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 40 from projecteuler.net

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

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

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

Input Format

First line contains that denotes the number of test cases. This is followed by lines, each containing an integers.

Constraints


Output Format

Print the answer corresponding to the test case.

Sample Input

1
1 2 3 4 5 6 7

Sample Output

5040

Author

shashank21j

Difficulty

Medium

Max Score

100

Submitted By

2626

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy