ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1209. 1, 10, 100, 1000...

wrong ans in case #3
Posted by Mushfiq Talha 13 Aug 2019 18:20
Code removed

Edited by author 20.08.2019 21:12
Re: wrong ans in case #3
Posted by 👨‍💻tproger👨‍💻 [ITMO] 14 Aug 2019 12:05
8*n-7 <--- integer overflow
Re: wrong ans in case #3
Posted by Mushfiq Talha 17 Aug 2019 19:12
Integer overflow. But why? And How?

Edited by author 17.08.2019 19:12
Re: wrong ans in case #3
Posted by Mushfiq Talha 17 Aug 2019 21:09
[code deleted]
This code gets wrong answer in case #3.

Edited by author 18.08.2019 20:49

Edited by author 18.08.2019 20:49

Edited by moderator 17.11.2019 18:48
Re: wrong ans in case #3
Posted by 👨‍💻tproger👨‍💻 [ITMO] 19 Aug 2019 18:16
On timus 'long int' is equal to 'int', to use 64-bit integers you need to write 'long long'.
Also, there is a precision error in your 'per_sq' function. This line:
return ((x-floor(x))?0:1);
must be written as
return (abs(x-floor(x)) > 1e-8 ? 0 : 1);
Re: wrong ans in case #3
Posted by Mushfiq Talha 20 Aug 2019 21:12
Thanks. I didn't know about the bit size of long in Timus. And what you said about the function. I had problem in the argument. I used double instead of int then it got accepted.