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.
Project Euler #8: Largest product in a series
Project Euler #8: Largest product in a series
Contest ends in
Sort by
recency
|
208 Discussions
|
Please Login in order to post a comment
All test cases passed:
def Solve_Prob(n,k,strm): maxi = -1 for i in range(0,n-k+1): pro = 1 for j in range(i,i+k): pro = pro*int(strm[j]) if pro > maxi: maxi = pro answer = maxi return answer
t = int(input()) for i in range(0,t): n,k = list(map(int,input().split())) m = input() answer = Solve_Prob(n,k,m) print(answer)
Javascript
Can someone find whats wrong with my code?
*
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
}
fuct m lừa bố mà y
include
include
using namespace std ; long long arr_anser[1001] ; long long answer(string s, int k){ for(int i = 0 ; i max){ max = product ; } } return max ; } int main(){ int t ; cin >> t ; for(int i = 0 ; i> n>> k ; cin >> s ; arr_anser[i] = answer(s, k) ; } for(int i = 0 ; i