GMQ - Editorial

PROBLEM LINK:

Practice

Contest

DIFFICULTY:

EASY

PREREQUISITES:

Factorization

PROBLEM:

Given an array, we have to give the sum of factors from L to R

QUICK EXPLANATION:

Store the factorized sum of each element while taking input.

Store the cumulative sum and return a[r]-a[l-1] for each query.

EXPLANATION:

This is a straight away question.
You just need to factorize an element and store all the factors.

for i in (1..n)
	fact[i] = fact[i-1] + factorize(a[i])
for each query
        print fact[r]-fact[l-1]

Do you want to hire dissertation writing services? Our approach for writing your dissertation is result-oriented.

//