I was trying to solve this question using smallest prime factor sieve. but i'm encountering a runtime error on my submission. could someone pls take a look into it and point the error out (FYI, it ran perfectly on my system IDE). tyvm in advance.
# | User | Rating |
---|---|---|
1 | tourist | 3803 |
2 | Benq | 3783 |
3 | Radewoosh | 3602 |
4 | maroonrk | 3575 |
5 | fantasy | 3526 |
6 | ko_osaga | 3500 |
7 | ksun48 | 3491 |
8 | Um_nik | 3486 |
9 | jiangly | 3474 |
10 | orzdevinwang | 3461 |
# | User | Contrib. |
---|---|---|
1 | awoo | 180 |
2 | -is-this-fft- | 177 |
3 | nor | 169 |
4 | Um_nik | 168 |
5 | SecondThread | 164 |
6 | maroonrk | 163 |
7 | adamant | 161 |
8 | kostka | 160 |
9 | YouKn0wWho | 158 |
10 | errorgorn | 153 |
I was trying to solve this question using smallest prime factor sieve. but i'm encountering a runtime error on my submission. could someone pls take a look into it and point the error out (FYI, it ran perfectly on my system IDE). tyvm in advance.
Name |
---|
You created a vector of size 10^9 . That is not possible in c++
alright thank you, could you please suggest an alternative if you can?
just try to solve it
\begin{equation} x+y=n \end{equation} \begin{equation} y= k*x \end{equation} \begin{equation} => n= (k+1)*x \end{equation}
we just need k to find the value of x & y
since (k+1) is one of the divisor of n we just search for the suitable value of k in the divisors
for even numbers k=1 => x=y
you can refer to my solution click here
Thanks a Ton!
Can you Please Explain , how you come to conclusion y = k * x ? please