@s1d_3: Stack limit can kill static arrays. Did you actually try submitting a code with a vector<> of that size?
in fact I learn some skills from bhishmaâs code,he use java,and i use C++. my ac code
Nice question!
Hey, what is meaning of result 1 âThe answer is the sum of dâ Ď(d) for all divisors d of Nâ.And please can you add some more theory about what approach you are exactly using to solve this problem.
That equivalently means that the result for a number ânâ is equal to the product of the result of two numbers ân1â and ân2â iff gcd(n1, n2)=1 i.e. they are coprime.
If n1 and n2 are further represented as the product of two coprime numbers, you eventually reach at the numbers that are âpowers of a single primeâ.
Now the only task is âhow to calculate the result for numbers, which are powers of a single prime?â
This is fairly simple and can be done by summing the phi(d).d for every divisor d of that number.
Have a look on this solution :
The basic approach for any problem is to think of the possible solution and observing the patterns while keeping the constraints in the mind at the same time.
When you get some approach, think about it and try to prove the correctness, if youâre not able to prove the correctness, try to find a counter example, if youâre not able to find one, never hesitate to implement the approach in long challenges. At the end, long challenge will teach you a lot.
@xariniov9
Thanks,I understand how to calculate the answer.I am unable to arrive at the proof can you please simplify the proof.
Nice editorial !!!
Could someone explain the proof of result 1 !
It would help many!!!
why canât v compute gcd using recursion and then loop over from i=0âŚn. it gives same resultâŚplz helpâŚ