Hey guys,

Hope you all are doing great. I am back with another problem of Project Euler on

Project Euler #8: Largest product in a series

Find the greatest product of KK consecutive digits in the NN digit number.

Input Format

First line contains TT that denotes the number of test cases.

First line of each test case will contain two integers NN & KK.

Second line of each test case will contain a NN digit integer. 

Output Format

Print the required answer for each test case.

Constraints

1≤T≤1001≤T≤100

1≤K≤71≤K≤7

K≤N≤1000K≤N≤1000

Sample Input

2 10 5 3675356291 10 5 2709360626 Sample Output

3150 0

Algorithm:

As easy can it get, this is a simple problem to directly multiply the sequence of number.

Hey guys,

Hope you all are doing great. I am back with another problem of Project Euler

Project Euler #2: Even Fibonacci numbers

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1,2,3,5,8,13,21,34,55,89,⋯

By considering the terms in the Fibonacci sequence whose values do not exceed N, find the sum of the even-valued terms.

Input Format

First line contains T that denotes the number of test cases.
2
Loading