GMQ - Editorial

editorial
factorization

#1

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* = fact[i-1] + factorize(a*)
for each query
        print fact[r]-fact[l-1]


#2

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