Hi , for div 2 500 i just used GP formula approach with error range of +-100 . http://ideone.com/NjEMww It failed on test case (837592744927492746) but on ideone it is giving correct answer ! Can any one please explain why ? Is it bug of topcoder ?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Hi , for div 2 500 i just used GP formula approach with error range of +-100 . http://ideone.com/NjEMww It failed on test case (837592744927492746) but on ideone it is giving correct answer ! Can any one please explain why ? Is it bug of topcoder ?
Name |
---|
On ideone it prints -1 while the answer should be 930658605474991929.
By the way what magic is this:
if(f(i) - S == (long long )0)
?4) 837592744927492746 Returns: -1 This is what the top coder test case is. Well it is supposed to be same as comparing if f(i)(Limaks operation) is equal to the required sum for the ith number . Could you find the bug ?
The test case is "837592744927492746" and yes, your code returns -1. I doesn't mean that the correct answer is -1.
I guess the mistake is that you don't use integers. You assume that pow() has precision 10 - 16, what isn't true.