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 ?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3947 |
2 | jiangly | 3734 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3612 |
7 | ecnerwala | 3581 |
8 | Geothermal | 3569 |
8 | cnnfls_csy | 3569 |
10 | ksun48 | 3479 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | awoo | 162 |
2 | maomao90 | 160 |
3 | nor | 156 |
4 | cry | 155 |
4 | adamant | 155 |
4 | atcoder_official | 155 |
4 | -is-this-fft- | 155 |
8 | maroonrk | 153 |
9 | SecondThread | 147 |
10 | Petr | 146 |
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 ?
Название |
---|
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.